How to completely solve mysql Chinese garbled characters

The table structure is as follows:


 

The installed mysql database cannot be inserted into the Chinese prompt as follows:



Use mysql> show variables like 'character%'; to view character set settings


 

Set client character set

 

Add character-set-server=utf8 to the my.ini file under the mysql installation directory

Re-view the mysql character set as follows:

 

Set database character set alter database test character set utf8

 

 

The second method:

Some of the above settings are only valid in the current window and there will be problems when reopening them.

①You can configure the mysql configuration file directly.

mysql/my.ini . (Systems after 5.5) are modified as follows:

[client]

default-character-set=utf8

[mysqld]

default-storage-engine=INNODB

character-set-server=utf8

collation-server=utf8_general_ci

 

②Restart mysql (/etc/init.d/mysql stop /etc/init.d/mysql start)

 

③ Recreate the table that cannot be inserted into Chinese.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326924632&siteId=291194637