PHP + MYSQL Chinese garbled Solution

Source: Internet
Author: User

Enter show variables like "character %" in the mysql console. The running result is shown in:

Setting the 12356 rows of value to GBK or UTF-8 can solve this problem.
1. First, check rows 1, 2, and 5.
Execute "set names gbk" or "set name utf8" in all PHP locations that use MYSQL ";
2. Check the third row, character_set_database.
You can enter alter database 'databasename' default character set gbk collate gbk_chinese_ci In the mysql console, or alter database 'databasename' default character set utf8 collate utf8_general_ci; to run.
3. The last line is the sixth line.
Open my. ini, find default-character-set, and change it to default-character-set = gbk or default-character-set = UTF-8. You can add them after [mysql] and [mysqld.
After completing the above operations, you will be OK.
Author: "front-end attack-usual"

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: 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.