Get the App
SLTechnology News&Howtos  ›  Database  › 

How to set and view character sets in mysql

Shulou Source: shulou.com Published: 2022-05-31 19:25:11 09月29日 Update

Mysql how to set and view the character set, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

1. List all character sets supported by MYSQL:

SHOW CHARACTER SET

two。 Current MYSQL server character set settings

SHOW VARIABLES LIKE 'character_set_%'

3. Current MYSQL server character set check settings

SHOW VARIABLES LIKE 'collation_%'

4. Show a character set setting

Show create database database name

5. Show a datasheet character set setting

Show create table table name

6. Modify database character set

Alter database database name default character set 'utf8'

7. Modify datasheet character set

Alter table table name default character set 'utf8'

8. Specify the character set when building the library

Create database database name character set gbk collate gbk_chinese_ci

9. Specify the character set when creating the table

CREATE TABLE `code` (

`id` TINYINT (255) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY

`content` VARCHAR (255) NOT NULL

) TYPE = MYISAM CHARACTER SET gbk COLLATE gbk_chinese_ci

Library character set, the following code is missing in my.cnf:

[client]

Default-character-set=utf8

[mysqld]

Default-character-set=utf8

After reading the above, have you mastered how to set and view the character set in mysql? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Characters character sets data databases content datasheets methods more servers problems services helpless for this code reasons skills articles experience industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn Microsoft Shulou Technology Shulou Information