Linux MySQL garbled Solution

Source: Internet
Author: User

In Linux:

MySQL version: ver 14.14 distrib 5.1.41

1 .)

VI/etc/My. CNF, add default-character-set = utf8 under [mysqld], and add default-character-set = utf8 under [client]
: WQ save and exit

 

2.) Run MySQL cmd, MySQL-> service MySQL restart

 

3) modify the MySQL database encoding. If the MySQL database encoding is incorrect, run the following command in MySQL: Alter database 'test' default Character Set utf8 collate utf8_bin.

The preceding command sets the encoding of MySQL's test database to utf8.

4). Modify the MySQL table encoding: alter table 'category 'default Character Set utf8collate utf8_bin. The preceding command is to change the category encoding of a table to utf8.

5 ). modify the field encoding: <br> alter table 'test' change 'dd' varchar (45) the character setutf8 collate utf8_bin not NULL command above is to change the DD field encoding in the MySQL database test table to utf8

You can use phpadmin to manage database settings.

 

6) Run

Show variables like 'character _ set % ';

 

Mysql> show variables like '% char % ';

+ ---------------------- + ---------------------
| Variable_name | value
+ ----------------------- + ---------------------
| Character_set_client | gb2312
| Character_set_connection | gb2312
| Character_set_database | gb2312
| Character_set_filesystem | binary
| Character_set_results | gb2312
| Character_set_server | gb2312
| Character_set_system | utf8
| Character_sets_dir |/usr/share/MySQL/charsets/
+ --------------------- + ----------------------

 

0

 

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.