Solving the problem of Chinese garbled in MySQL database

Source: Internet
Author: User
Tags mysql version

Today finally solved the database Chinese garbled problem, share out let more people as reference, we enter the theme:

If the MySQL database is not set when the encoding format, in the future development, the Chinese garbled will be a headache, so I am here to share a complete solution to the garbled method:

I am in the Ubuntu Cloud Server environment under the settings, the operation of the Windows operating system is more simple, here do not repeat, the method is similar, you can access the information themselves.

First enter at the command line:

#cd/etc/mysql

After entering the directory, then modify the my.cnf configuration file (MySQL version above 5.5, now basically is more than this)

#vim my.cnf

Modify the following in the editing area:

[Client]
Default-character-set=utf8

Default-storage-engine=innodb
Character-set-server=utf8
Collation-server=utf8_general_ci

Then save the changes and exit (: Wq)

Then enter:

#mysql-U root-p

Into the database, enter a command to see if the encoding has been modified

Results

To now have modified the encoding format, and then will not appear garbled,, you can insert data to try, hey, as long as the courage to try, the problem will be solved, I believe we can.

by Still,

Solving the problem of Chinese garbled in MySQL database

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.