Home  >  Article  >  Database  >  How to modify table character encoding in mysql

How to modify table character encoding in mysql

coldplay.xixi
coldplay.xixiOriginal
2020-10-10 15:26:056277browse

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();

2. Query the character set currently used by MySQL:

  SHOW VARIABLES LIKE '%character%';

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%';

4 , View the column information of the data table:

  SHOW FULL COLUMNS FROM t_text;

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;

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!

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