Chinese garbled database and analysis

Insert Chinese characters garbled good problem to the database

Database garbled mainly because the server and client, or the database itself is caused by different coding.

The main situation is as follows:

One problem .mysql database

test:

  Use mysql -u root -p login to the database, enter

 After I finished this change is to ensure that all are utf8.

mysql> show variables like "%char%";

The default is that the client and server have used latin1, it will be garbled. Here the characters are changed utf8;

vi /etc/my.cnf respectively, add the following statement after the save changes, and then restart the database.

/etc/inint.d/mysqld restart // restart the database

 And then view the character set again:

mysql> show variables like "% char%"; you can see have been changed over, and then see if the data in the database is still garbled.

 

 

Two .navicat problems (other database tools not used, may also have this problem)

In navicat create a new connection, or to automatically set the code set is utf8 can, after it.

 

Guess you like

Origin www.cnblogs.com/wuzm/p/11392452.html