In a Debian environment, completely solve the problem that MySQL cannot insert and display Chinese
Linux under MySQL insert Chinese display garbled solution
Mysql-uroot-p return Enter password
Enter the MySQL view status as follows:
The default is the client and server are used latin1, so will be garbled.
Solution:
Mysql>user MyDB;
Mysql>alter database mydb Character Set utf8;!
The above mentioned the use of temporary methods to change the database's character set settings, display Chinese, but later found in some systems can not be successful.
For example, I used Debian 7.0, looking for a long time to find a solution for the Debian system,Debian 7.0 tested successfully, others such as modify client and MySQL join default-character-set= UTF8 methods and the like, only apply with 5.5 before the system!
Ultimate solution, once and for all:
Debian under the MySQL string modified for UTF8 (reference: Rainysia's Column)
First, enter MySQL (mysql-uroot-p), view the current database character set (status;)
Second, view the current system version (LSB_RELEASE-A)
Third, #vim/etc/mysql/my.cnf. (5.5 prior system) join Default-character-set=utf8 under "client"
Join Default-character-set=utf8 under "mysqld"
Notice: Note If you can not start the error after modification try to change the Default-character-set=utf8 to Character_set_server=utf8, just add to the mysqld below. Client doesn't need to add.
Four, #vim/etc/mysql/my.cnf. (after 5.5 system) modify as follows:
[Client]
Default-character-set=utf8
[Mysqld]
Default-storage-engine=innodb
Character-set-server=utf8
Collation-server=utf8_general_ci
Five, restart MySQL (/etc/init.d/mysql stop/etc/init.d/mysql start)
Six, build success, enter MySQL view character set (Mysql>show variables like ' character_set_% ';)
MySQL cannot insert Chinese