Mysql Chinese garbled Solution

Source: Internet
Author: User
Tags mysql tutorial

Find the mysql tutorial configuration file
The mysql configuration file is/etc/init. d/mysql/my. cnf. (This file does not necessarily exist if it is not ubuntu9.0.4. Since the MySQL installation method you may use is different from the one mentioned on the Internet, you may not be able to find/etc/init. d/mysql/my. cnf. Therefore, you need to use the find command to find the cnf file. Remember not to go to my. cnf because it does not necessarily exist, but should look for *. cnf.
2. Back up cp/etc/init. d/mysql/my. cnf/etc/my. cnf. bak before modification.
Open my. cnf and modify the encoding.
# Sudo vi/etc/init. d/mysql/my. cnf
Add under [mysqld]
Default-character-set = utf8
Add under [client]
Default-character-set = utf8
3. Restart mysql
Use unused commands to restart your mysql instance based on the method in which you install mysql. If you have configured the mysqld auto-start mode, you can execute
Cd/usr/bin/
Mysqladmin-uroot-proot shutdownmysqld_safe & (if the permission is insufficient, run sudo mysql_safe &)
4. Use the statement show variables like 'character %'
Only one is latin and the other is utf8.

Change the cmd (dos) encoding method in windows to UTF-8
Chcp command,
Chcp 65001 is replaced with the UTF-8 code page
Chcp 936 can be switched back to the default GBK
Chcp 437 is in the United States. Note: modifying the encoding in personal testing CMD cannot solve MYSQL garbled characters.

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.