The following articles mainly describe the correct solution to the MySQL 5 garbled problem, including the phpMyAdmin settings, the content that should be set during database creation, and how to use SQL to create related projects in tables, and other related content, we hope you will receive the harvest.
Solution to MySQL 5 garbled Problem1. Set phpMyAdmin
Language: Chinese simplified (zh-utf-8)
MySQL Character Set: UTF-8 Unicode (utf8)
MySQL connection verification: gbk_chinese_ci
2. When creating a database
Set it to gbk_chinese_ci.
MySQL 5 garbled problem solution 3 use SQL to create a table
- ENGINE=MyISAM DEFAULT CHARSET=gbk;
- ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=40 ;
4. Check table structure
The varchar (100) sorting attribute is gbk_chinese_ci.
The sorting attribute of other types is empty.
MySQL 5 garbled problem solution 5 add to the code
$ Db-> query ("set character set gbk"); required in Linux, not required in Windows
This is equivalent to Connection Character Sets and Collations.
The above content is an introduction to the solution to the MySQL 5 garbled problem. I hope you will have some gains.