Home  >  Article  >  Database  >  How to query mysql encoding

How to query mysql encoding

青灯夜游
青灯夜游Original
2021-12-28 18:38:2615174browse

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.

How to query mysql 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn