Home  >  Article  >  Database  >  Solution to the problem of importing Chinese garbled characters into mysql database

Solution to the problem of importing Chinese garbled characters into mysql database

php是最好的语言
php是最好的语言Original
2018-07-24 10:36:232325browse

What should I do if the Chinese characters in mysql database are garbled? How to solve the problem of Chinese garbled characters after importing mysql data? How to deal with it? In the past two days, I used a data CSV file containing Chinese fields in the project. I used workbench to import the file and reported an error:

Solution to the problem of importing Chinese garbled characters into mysql database

I searched for it online for a long time and all said it was. The CSV file encoding does not match the client encoding. Try converting the CSV to utf8 encoding, but the import still does not work.

Finally use the Navicat tool to complete the import:

Solution to the problem of importing Chinese garbled characters into mysql database

Solution to the problem of importing Chinese garbled characters into mysql database

Solution to the problem of importing Chinese garbled characters into mysql database

##Encoding is particularly important. You must choose 10008 (MAC-Simplified Chinese GB 2312). You cannot use the default utf-8 because CSV files containing Chinese generally use the 10008 encoding method. Not utf8.

Error method:

Solution to the problem of importing Chinese garbled characters into mysql database

Solution to the problem of importing Chinese garbled characters into mysql database

If the encoding is incorrect, garbled characters will appear! ! !

Solution to the problem of importing Chinese garbled characters into mysql database

Solution to the problem of importing Chinese garbled characters into mysql database

At this point, the mysql data import work is completed!

Solution to the problem of importing Chinese garbled characters into mysql database

So far, the problem of Chinese garbled characters in the mysql database has been completely solved!

[Related article recommendations]

mysql database Chinese garbled solution_MySQL

##MySQL database table garbled solution_MySQL

[Related video course recommendations]

Garbled code problem-Six days to take you through the MySQL video tutorial

The ultimate solution to garbled data display Method - PHP introductory video tutorial one, learn PHP in one week

The above is the detailed content of Solution to the problem of importing Chinese garbled characters into mysql database. For more information, please follow other related articles on the PHP Chinese website!

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