The author of the website has been in the database from the virtual space to a separate server, just installed above the database code with my original, the original is latin1, the current is the GBK format, due to different coding, sometimes the site will appear garbled, Here's a brief look at how to view and modify the encoding of the MySQL database:
1. View Database encoding
First look at the currently used database encoding, login database management, run the statement:
Mysql> Use Testsql
Database changed
Mysql> Show variables like ' character_set_database ';
+------------------------+-------+
| variable_name | Value |
+------------------------+-------+
| Character_set_database | Latin1 |
+------------------------+-------+
1 row in Set (0.00 sec)
First switch to the TESTSQL database and then use the SQL statement: Show variables like ' character_set_database '; You can see that the TESTSQL database is latin1 encoded.
2. Modify the database encoding
To modify the code of the database Testsql, modify it to GBK.
mysql> ALTER DATABASE Testsql CHARACTER SET GBK;
Query OK, 1 row Affected (0.00 sec)
Mysql> Show variables like ' character_set_database ';
+------------------------+--------+
| variable_name | Value |
+------------------------+--------+
| Character_set_database | GBK |
+------------------------+--------+
1 row in Set (0.00 sec)
This article is from the "Chinese name Chong + Technology Blog" blog, please be sure to keep this source http://nj63nscom.blog.51cto.com/1050383/1559325
How to view and modify the encoding of a MySQL database