MySQL utf8 settings

Source: Internet
Author: User

Part1: Change MySQL Default character set to utf8 in my. CNF

Http://stackoverflow.com/questions/3513773/change-mysql-default-character-set-to-utf8-in-my-cnf

[Mysqld]
Init_connect = 'set collation_connection = utf8_unicode_ci'
Init_connect = 'set names utf8'
Character-set-Server = utf8
Collation-Server = utf8_unicode_ci
Skip-character-set-client-handshake

[Client]
Default-character-set = utf8

[MySQL]
Default-character-set = utf8

 

Part2: changing the character set of an existing database

Mysql> alter database zuche_production Character Set utf8 collate utf8_unicode_ci;
Query OK, 1 row affected (0.00 Sec)

 

Part3: useful statements

Mysql> show table status from zuche_production;

Mysql> show variables like "% character %"; show variables like "% collation % ";
+ -------------------------- + ---------------------------- +
| 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/|
+ -------------------------- + ---------------------------- +
8 rows in SET (0.00 Sec)

+ ---------------------- + ----------------- +
| Variable_name | value |
+ ---------------------- + ----------------- +
| Collation_connection | utf8_unicode_ci |
| Collation_database | utf8_unicode_ci |
| Collation_server | utf8_unicode_ci |
+ ---------------------- + ----------------- +
3 rows in SET (0.00 Sec)

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.