MySQL Chinese garbled problem under Linux

Source: Internet
Author: User
  1. If the front-end data, the back-end data are UFT-8 encoding, the program can not find any problems, but still appear to insert the database garbled, it is possible that the MySQL database server itself character set encoding problems

  2. Use Mysql-front to connect to the database after execution: show variables like ' character% ';

    It can be found that the character set encoding character_set_server here is Latin1

  3. Modify the/etc/my.cnf file, modify the line to add Character-set-server=utf8

    [Email protected] ~]# CAT/ETC/MY.CNF [mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser= mysqldefault-storage-engine=innodbcharacter-set-server=utf8# disabling symbolic-links is recommended to prevent Assorted Security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/ Mysqld.pid
  4. Restarting the MySQL server

    Service mysqld Restart

  5. View MySQL server character encoding set

    In this way, there will be no garbled.

MySQL Chinese garbled problem under Linux

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.