Workaround:
Start--> run-->cmd--> into the DOS command form: (if the command cannot be executed, place the MySQL installation path at the front of the system variable path)
1. Character set settings for fields in a database table. Show CREATE TABLE tablename or show full columns from TableName
The code is as follows |
Copy Code |
Mysql> Show CREATE table T1; + ——-+ ———————————— | Table | Create Table + ——-+ ———————————— | T1 | CREATE TABLE ' T1 ' ( ' id ' int (one) not NULL, ' C1 ' varchar DEFAULT NULL, PRIMARY KEY (' id ') ) Engine=myisam DEFAULT CHARSET=GBK | + ——-+ ———————————— 1 row in Set (0.00 sec)
Mysql> show full columns from T1; + ——-+ ————-+ —————-+--+-–+- | Field | Type | Collation | Null | Key | + ——-+ ————-+ —————-+--+-–+- | ID | Int (11) | NULL | NO | PRI | | C1 | varchar (30) | Gbk_chinese_ci | YES | | + ——-+ ————-+ —————-+--+-–+- 2 rows in Set (0.00 sec) Mysql> |
2. Current connection system parameters show variables like ' char% '
code is as follows |
copy code |
mysql> show variables like ' char% '; + ———————— –+ —————- | variable_name | Value + ———————— –+ —————- | character_set_client | GBK | character_set_connection | GBK | character_set_database | latin1 | character_set_filesystem | binary | character_set_ results | GBK | character_set_server | latin1 | character_set_system | UTF8 | character_sets_dir | C:Program File + ———————— –+ —————- 8 rows in Set (0.00 sec) Mysql> |
1. In Chinese, make sure that the character set for this field in the table is Chinese compatible:
Big5 | Big5 Traditional Chinese
gb2312 | GB2312 Simplified Chinese
GBK | GBK Simplified Chinese
UTF8 | UTF-8 Unicode
MySQL Export command:
The code is as follows |
Copy Code |
1.mysqldump-hlocalhost-p3306-uroot-p123456--default-character-set=gb2312 Mysql>f:/pushingdb.sql
|
MySQL Import command:
The code is as follows |
Copy Code |
1.mysql-uroot-p123456--default-character-set=gb2312 Test<f:/pushingdb.sql
|
Note: Root is the database username, 123456 is the database password, MySQL is the database name, F:/pushingdb.sql indicates the location of the export to the local;
If you modify the MySQL character set directly, we just need to use the MySQL command in the command
code is as follows |
copy code |
mysql> SET character_set_client = UTF8; mysql> SET character_set_connection = UTF8; |