Solution to mysql5 Chinese gibber problem
- 2020-06-15 10:22:42
- OfStack
The MySQL5 garbled code problem can be solved in the following ways:
1. Set the phpMyAdmin
Language:Chinese simplified (zh-utf-8)
MySQL Character set: UTF-8 Unicode (utf8)
MySQL The connection to proofread gbk_chinese_ci
2. When creating a database
Tidy is set to gbk_chinese_ci
3. Create tables with SQL
ENGINE=MyISAM DEFAULT CHARSET=gbk;
ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=40 ;
4. In the structure of the checklist
The collation attribute of varchar(100) is gbk_chinese_ci
Other types of collation properties are empty.
5. Add to the code
$db- > query (" SET CHARACTER SET GBK "); Required under Linux, not under Windows.
This operation is equivalent to Connection Character Sets and Collations