CentOS modified MySQL Character set

Source: Internet
Author: User
Tags set set

1, mysql>show variables like ' character_set% ';

Shown below:

+--------------------------+----------------------------+  | Variable_name            | Value                      |  +--------------------------+----------------------------+  | character_set_client     | latin1                     |  | character_set_connection | Latin1                     | |  character_set_database   | latin1                     | |  character_set_filesystem | binary                     |  | Character_set_results |    latin1                     |  | character_set_server     | latin1                     |  | character_set_ System     | UTF8                       |  | character_sets_dir       |/usr/share/mysql/charsets/|  

2, Backup my.cnf Cp/etc/my.cnf/etc/my.cnf.bak

3, modify the MY.CNF, the results are as follows

 [client] Port  =3306 socket  =/var/lib/ Mysql/mysql.sock  default -character-set= utf8 [mysqld] datadir  =/var/lib/mysql socket  =/var/lib/mysql/mysql.sock user  =mysql # Disabling symbolic -links is recommended to prevent assorted security risks symbolic -links=0 character -set-server=utf8 [ MySQL] no -auto-rehash  default - Character-set=utf8 [mysqld_safe] Log -error=/var/log/ mysqld.log pid -file=/var/run/mysqld/mysqld.pid 

4. Restart MySQL Services sudo service mysqld restart

5, mysql>show variables like ' character_set% ';

After entering the MySQL console, execute the following command

1. 1 Modify the server default characterset setcharacter_set_server = 1. 2 Modifying the database characterset Set character_set_database =  1. 3 Modifying the database client character setsetcharacter_set_client = 1. 4 Modifying the connection default character Set set Character_set_connection=  Utf8

22default character Set UTF8

The results are as follows:

+--------------------------+----------------------------+  | Variable_name            | Value                      |  +--------------------------+----------------------------+  | character_set_client     | UTF8                       |  | character_set_connection | UTF8                       | |  character_set_database   | UTF8                       | |  character_set_filesystem | binary                     |  | character_set_results |    UTF8                       |  | character_set_server     | UTF8                       |  | character_set_ System     | UTF8                       |  | character_sets_dir       |/usr/share/mysql/charsets/|  +--------------------------+----------------------------+  

6. Some other common commands

Set Password use mysql;update user set password=password (' password ') where user= ' root '; flush privileges;
*. * to ' root ' @ '% ' identified by ' 123456 ' with GRANT option;

CentOS modified MySQL Character set

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.