修改my.ini文件
以下添加
[mysql]
default-character-set=utf8
[mysqld]
character_set_server = utf8
init_connect=‘SET NAMES utf8‘
修改完毕后重新启动后,查看下面的参数。
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
8 rows in set (0.01 sec)
mysql> show variables like ‘coll%‘;
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
mysql数据库默认编码配置
标签: