Home > Database > Mysql Tutorial > body text

How to modify table character encoding in mysql

coldplay.xixi
Release: 2020-10-10 15:26:05
Original
6273 people have browsed it

Mysql method to modify table character encoding: use DEFAULT to modify the character set, the code is [ALTER TABLE t_text DEFAULT CHARACTER SET utf8mb4; 6. Modify the character set of the nickname field in the data table t_text:].

How to modify table character encoding in mysql

Mysql method to modify table character encoding:

1. Query the MySQL version:

SELECT VERSION();
Copy after login

2. Query the character set currently used by MySQL:

  SHOW VARIABLES LIKE '%character%';
Copy after login

3. Query the status information of the specified data table of the specified database (db_test is the database, t_text is the data table):

  SHOW TABLE STATUS FROM `db_test` LIKE '%t_text%';
Copy after login

4 , View the column information of the data table:

  SHOW FULL COLUMNS FROM t_text;
Copy after login

5. Modify the character set of the data table t_text:

  ALTER TABLE t_text DEFAULT CHARACTER SET utf8mb4;6、修改数据表 t_text 中的 nickname 字段的字符集:
  ALTER TABLE t_text CHANGE nickname nickname VARCHAR(256) CHARACTER SET utf8mb4 NOT NULL;
Copy after login

Related free learning recommendations: mysql video tutorial

The above is the detailed content of How to modify table character encoding in mysql. 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