Get the App
SLTechnology News&Howtos  ›  Database  › 

How to configure MySQL in Chinese

Shulou Source: shulou.com Published: 2022-05-31 11:36:30 10月02日 Update

This article mainly shows you "MySQL Chinese how to configure", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "MySQL Chinese how to configure" this article.

1. The character set settings for the fields in the table. Show create table TableName or show full columns from tableName

> show create table T1

+-

| | Table | Create Table |

+-

| | T1 | CREATE TABLE `t1` (

`id`int (11) NOT NULL

`c1` varchar (30) DEFAULT NULL

PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=gbk |

+-

1 row in set (0.00 sec)

Mysql > show full columns from T1

+-

| | Field | Type | Collation | Null | Key | |

+-

| | id | int (11) | NULL | NO | PRI | |

| | C1 | varchar (30) | gbk_chinese_ci | YES |

+-

2 rows in set (0.00 sec)

Mysql >

two。 The current connection system parameter show variables like 'char%'

Mysql > show variables like 'char%'

+-

| | Variable_name | Value |

+-

| | character_set_client | gbk |

| | character_set_connection | gbk |

| | character_set_database | latin1 |

| | character_set_filesystem | binary |

| | character_set_results | gbk |

| | character_set_server | latin1 |

| | character_set_system | utf8 |

| | character_sets_dir | C:/Program File |

+-

8 rows in set (0.00 sec)

Mysql >

a. In Chinese, please make sure that the character set of this field in the table is compatible with Chinese:

Big5 | Big5 Traditional Chinese

Gb2312 | GB2312 Simplified Chinese

Gbk | GBK Simplified Chinese

Utf8 | UTF-8 Unicode

b. Make sure that the join parameters are consistent with the field character set, and you can use setname' charsetname'

For example, set name 'gbk'

This command also modifies the character_set_client,character_set_connection,character_set_results

(if your MySQL is all in Chinese, you can add or modify this parameter in my.ini or my.cnf. You need to restart the MySQL service after modifying the parameter file.)

[mysql]

Default-character-set=utf8

The above is all the contents of the article "how to configure MySQL in Chinese". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Chinese parameters configuration content fields characters articles character sets learning help consistency at the same time commands files easy to understand more organization knowledge system editing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Docker Huawei OPPO Reno Shulou Technology