1. Check the code for your own installed MySQL
2. View MySQL-supported encodings
3. View Database encoding
4. View Data sheet encoding (Show create table user \g;)
5, modify the My.ini file to modify the code: plus default-character-set= Character set (utf8.gbk.gb2312, etc.)
6. Command line modification: ALTER DATABASE da_name default character set ' CharSet '; or set names 'charset'; ALTER DATABASE TestDB CHA Racter set UTF8;
8. View the database service and the client character set:
9, the Linux system changes:
1) Export Data
[Email protected] ~]$ mysqldump-u root-p dbname--default-character-set=gbk > base_user.sql;
2) View the encoding of the exported SQL file
[[Email protected] ~]$ file Base_user.sql
Base_user.sql:utf-8 Unicode text, with very long lines
3) Turn to the code you want to use
[Email protected] ~]$ iconv-f utf-8-t GBK base_user.sql >base_user_gbk.sql
4) Connect to the database and view the encoding of the current library
[Email protected] ~]$ Mysql-uroot
mysql> use TestDB;
mysql> status;
Server characterset:latin1
Db CHARACTERSET:GBK
Client characterset:latin1
Conn. characterset:latin1
5) Set the required encoding
Mysql>set names ' GBK ';
6) View the current encoding
mysql> status;
Server characterset:latin1
Db CHARACTERSET:GBK
Client CHARACTERSET:GBK
Conn. CHARACTERSET:GBK
7) Import the files we converted into GBK
Mysql> source Base_user_gbk.sql;