Summary of problems with MySQL character set

Source: Internet
Author: User


In general, we add the configuration in the configuration file my.cnf:

[Client]default-character-set = UTF8 [mysqld]default-character-set = utf8character-set-server = Utf8init-connect = ' Set NAMES UTF8 ' collation-server = utf8_general_ci #可选的


Specify a character set when creating a database:

Create database Zabbix character set UTF8 collate utf8_bin;


View the database's character set in MySQL connection state:

Show CREATE Database Zabbix_office; #查看创建数据库的字符集
Show variables like ' character% '; #查看mysql默认的字符集


To modify a character set:

SET character_set_client = UTF8; SET character_set_connection = UTF8;  SET character_set_results = UTF8;       SET character_set_database = UTF8;   SET character_set_server = UTF8;  SET collation_connection = UTF8;   SET collation_database = UTF8; SET collation_server = UTF8;


Client connection still see is garbled, this time to see whether the client's character set and the service side of the character set is consistent, if inconsistent, to modify the client character set:

SET NAMES ' UTF8 ';


Modify the default character set for the created database, this is not a good idea, you can only export data, delete the library and then rebuild the library to specify the default character set.

Create database Zabbix character set UTF8 collate utf8_bin;


This article from "Wang Jiadong elder brother" blog, declined reprint!

Summary of problems with MySQL character set

Related Article

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.