Home >Database >Mysql Tutorial >How to query mysql encoding
How to query mysql encoding: 1. Use the "show variables like 'character_set_database';" statement to view the database encoding format; 2. Use the "show create table data table name;" statement to view the data table encoding.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
View the mysql database and table encoding format
1. View the database encoding format
mysql> show variables like 'character_set_database';
2. View the data table Encoding format
mysql> show create table <表名>;
Expand knowledge: Modify the encoding format
1. Modify the encoding format of the database
mysql>alter database <数据库名> character set utf8;
2. Modify the encoding format of the data table
mysql>alter table <表名> character set utf8;
3. Modify the field encoding format
mysql>alter table <表名> change <字段名> <字段名> <类型> character set utf8; mysql>alter table user change username username varchar(20) character set utf8 not null;
[Related recommendations: mysql video tutorial]
The above is the detailed content of How to query mysql encoding. For more information, please follow other related articles on the PHP Chinese website!