Encoding and conversion of MySQL tables is a common problem, which makes it difficult for many people. The following describes how to solve the problem of MySQL table encoding conversion. I hope it will be helpful for you to learn about MySQL table encoding conversion.
Step 1: Use Phpmyadmin and mysqldump to export the table structure of the data table to be exported. If you do not need to export it, change CHARSET = latin1 of the create table statement to CHARSET = utf8, execute the create table statement in the newdbname of the target database to create the table structure, and then start exporting and importing data. Command:
./Mysqldump-d DB_Dig>/usr/local/tmp/tables. SQL
Step 2: Go to the mysql command line and choose mysql-hlocalhost-uroot-p *** dbname
Step 3: Execute SQL select * from tbname into outfile '/usr/local/tbname. SQL ';
Step 4. Set tbname. SQL transcoding is in UTF-8 format and we recommend that you use UltraEditor to either directly use the 'convert-> ASCII to UTF-8 (Unicode edit)' of the editor or save the file as a UTF-8 (without BOM) Format
Step 5: Execute the statement set character_set_database = utf8 In the mysql command line. Note: set the mysql environment variable so that mysql will explain the file content in the form of utf8 when reading the SQL file in the next step.
Step 6 run the load data infile 'tbname. SQL 'into table newdbname. tbname Statement on the mysql command line;
Note: Do not forget step 4.
Mysql multi-Table query implementation
Mysql temporary table usage
MySQL Stored Procedure for table splitting
MySQL lock table Introduction
Detailed description of MySQL Data Table types