码迷,mamicode.com
首页 > 数据库 > 详细

ubuntu mysql编码设置5.5以后

时间:2015-11-19 18:11:34      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

安装了mysql。

版本:5.5.28
操作系统 :ubuntu 12.10
mysql> show variables like character%;


+--------------------------+----------------------------+

| Variable_name            | Value                      |

+--------------------------+----------------------------+

| character_set_client     | utf8                       |

| character_set_connection | utf8                       |

| character_set_database   | latin1                     |

| character_set_filesystem | binary                     |

| character_set_results    | utf8                       |

| character_set_server     | latin1                     |

| character_set_system     | utf8                       |

| character_sets_dir       | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

 

 

创建一个表查看是latin1的格式,修改/etc/my.cnf
添加:
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
/etc/init.d/mysql restart  #启动不了了。
 
后来查得原来从5版本之后变了,需要这样修改
[client]

default-character-set=utf8

[mysqld]

character-set-server=utf8

 

/etc/init.d/mysql restart  #启动成功


mysql> show variables like ‘character%‘;

+--------------------------+----------------------------+

| Variable_name            | Value                      |

+--------------------------+----------------------------+

| character_set_client     | utf8                       |

| character_set_connection | utf8                       |

| character_set_database   | utf8                       |

| character_set_filesystem | binary                     |

| character_set_results    | utf8                       |

| character_set_server     | utf8                       |

| character_set_system     | utf8                       |

| character_sets_dir       | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

 

 
修改成功。

ubuntu mysql编码设置5.5以后

标签:

原文地址:http://www.cnblogs.com/laijie/p/4978149.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!