修改Mysql默认编码

时间:2021-08-05 11:05:44

show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     | 
| character_set_connection | latin1                     | 
| character_set_database   | latin1                     | 
| character_set_filesystem | binary                     | 
| character_set_results    | latin1                     | 
| character_set_server     | latin1                     | 
| character_set_system     | utf8                       | 
+--------------------------+----------------------------+

默认MYSQL的编码如图所示,需要修改默认编码可以修改my.ini文件,linux下my.cnf

 添加
[mysqld]
character_set_server = utf8 [mysql]
default-character-set = utf8 [client]
default-character-set = utf8

重启mysql,输入

show variables like '%char%';

修改Mysql默认编码