Home > Database > Mysql Tutorial > body text

How to solve the garbled code problem in MySQL 5.0.16

巴扎黑
Release: 2017-03-19 10:10:37
Original
1072 people have browsed it

[Introduction] Question: How to solve the garbled problem of MySQL 5 0 16? Answer: The garbled code problem of MySQL 5 0 16 can be solved by the following method: 1 Set phpMyAdmin Language: Chinese simplified (zh-utf-8) MySQL character set: UTF-8 Unicode (utf8) MySQL

Q: How to solve the garbled code problem in MySQL 5.0.16?

Answer: The garbled code problem in MySQL 5.0.16 can be solved by the following method:

1. Set up phpMyAdmin


Language:Chinese simplified (zh-utf- 8)

MySQL character set: UTF-8 Unicode (utf8)

MySQL connection proofreading gbk_chinese_ci


2. When creating the database


Organize and set it to gbk_chinese_ci

3. Use SQL to create the table


ENGINE=MyISAM DEFAULT CHARSET=gbk;

ENGINE= InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=40 ;

4. Check that the sorting attribute of


varchar(100) in the table structure is gbk_chinese_ci


The finishing attributes of other types are empty.

5. Add


$db->query("SET CHARACTER SET GBK"); in the code. It is required under Linux, but not under Windows. need.


This operation is equivalent to Connection Character Sets and Collations

The above is the detailed content of How to solve the garbled code problem in MySQL 5.0.16. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!