Install MySQL Chinese code under Linux

Source: Internet
Author: User

The solution is as follows:

The code is as follows Copy Code

#vi/etc/my.cnf

Add the following coding settings in the appropriate place

The code is as follows Copy Code

[Mysqld]
Default-character-set=gbk

[Mysql.server]
Default-character-set=gbk

[Mysqld_safe]

Default-character-set=gbk

[Client]
Default-character-set=gbk

[MySQL]
Default-character-set=gbk

Restart MySQL.

If you don't know where MySQL is, run

The code is as follows Copy Code
#whereis MySQL

You can find where MySQL is installed.

If you want to check if the settings are successful, you can run the following command:

The code is as follows Copy Code

# mysql-u Root-proot
Welcome to the MySQL Monitor. Commands End With; or G.
Your MySQL Connection ID is 2 to server version:5.0.22

Type ' help, ' or ' h ' for help. Type ' C ' to clear the buffer.

Mysql> Show variables like '%char% ';
+--------------------------+----------------------------+
| variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | GBK |
| character_set_connection | GBK |
| Character_set_database | GBK |
| Character_set_filesystem | binary |
| Character_set_results | GBK |
| Character_set_server | GBK |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/share/mysql/charsets/|
+--------------------------+----------------------------+
8 rows in Set (0.00 sec)

The above has shown that the encoding settings have been successful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.