MySQL Setup encoding

Source: Internet
Author: User

MySQL Setup encoding version mysql-5.6.21-winx64


MySQL default encoding:
mysql> show variables like  ' character% '; +--------------------------+------------------- --------------------------+| 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       | d:\soft\mysql-5.6.21-winx64\share\ charsets\ |+--------------------------+---------------------------------------------+8 rows in  set  (0.00 sec) mysql>


MySQL Setup encoding

SET character_set_client = UTF8;

SET character_set_connection = UTF8;

SET character_set_database = UTF8;

SET character_set_results = UTF8;

SET character_set_server = UTF8;

mysql> SET character_set_client = UTF8; Query OK, 0 rows Affected (0.00 sec) mysql> SET character_set_connection = UTF8; Query OK, 0 rows Affected (0.00 sec) mysql> SET character_set_database = UTF8; Query OK, 0 rows Affected (0.00 sec) mysql> SET character_set_results = UTF8; Query OK, 0 rows Affected (0.00 sec) mysql> SET character_set_server = UTF8; Query OK, 0 rows Affected (0.00 sec) mysql>

This method is only valid in the current state and is invalidated when the database service is restarted. so if you want to not garbled only modify the My.ini file.


Modify the My.ini file setting encoding
[Client]default-character-set=utf8[mysql]default-character-set=utf8[mysqld]character-set-server=utf8

Under the corresponding label, add the following configuration:

To restart the MySQL server:

C:\users\lenovo>net Stop Mysqlmysql service is stopping. The MySQL service has stopped successfully. C:\users\lenovo>net Start Mysqlmysql service is starting. The MySQL service has started successfully. C:\users\lenovo>


===========end===========


MySQL Setup encoding

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.