Method: 1. Add "character_set_server=utf8" under mysqld in "my.cnf" and "default-character-set=utf8" under client; 2. Restart with "service mysql restart" .
The operating environment of this tutorial: windows10 system, mysql5.6 version, Dell G3 computer.
mysql 5.6 Modify the character set
View character set:
show variables like 'character%'; show variables like '%char%';
The default is used by both the client and the server latin1 is changed, so Chinese characters will be garbled.
1. Modify the character set
Modify the /etc/my.cnf configuration file
[mysqld] character_set_server=utf8 collation-server=utf8_general_ci ...... [client] #设置客户端字符集 default-character-set=utf8
2. Restart mysql
service mysql restart
Command settings will take effect
create database aa default-character-set=utf8; --只有这个数据库是utf-8
Recommended learning: mysql video tutorial
The above is the detailed content of How to modify the character set in mysql5.6. For more information, please follow other related articles on the PHP Chinese website!