Step 6 helps you easily solve the problem of MySQL table encoding conversion

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.