Ubuntu mysql中文乱码解决

#vim /etc/mysql/my.cnf

找到[mysqld]添加

character-set-server = utf8

重启mysql

#restart mysql

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/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

你可能感兴趣的:(ubuntu)