Home > Database > Mysql Tutorial > body text

How to query mysql encoding

青灯夜游
Release: 2021-12-28 18:38:26
Original
15183 people have browsed it

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';
Copy after login

2. View the data table Encoding format

mysql> show create table <表名>;
Copy after login

Expand knowledge: Modify the encoding format

1. Modify the encoding format of the database

mysql>alter database <数据库名> character set utf8;
Copy after login

2. Modify the encoding format of the data table

mysql>alter table <表名> character set utf8;
Copy after login

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;
Copy after login

[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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template