Recently got a dozens of m of MySQL script file, ready to revert to the database.
Used to use the Mysql-front for a short time MySQL, first use it to try, the results hang off.
Well, first create an empty database with Mysql-front, and then import it using the MySQL command line.
1 Use Mysql-front to create an empty database
Because look at the object in the script have default CHARSET=GBK comment= ... directive, so character set selection GBK
2 start the MySQL command line, enter the password
3 using the new database B
Enter command: use B;
4 Change the file read character set to UTF8, this step is critical
At the beginning, when you see the default CHARSET=GBK comment= ... and think you want to set it to GBK, you use the following instructions:
Set names GBK;
But when you import, it's all an error and you can't recognize Chinese.
Later realized that it should be set to the character set of the SQL file itself, what is the character set of the SQL file itself?
My method is to open the file with the Vs.net IDE and save As, select "Encoding Save"
Thus the character set is utf-8;
So
Input command: set names UTF8; Note that it is not set names Utf-8;
5) Import File
Input command: source file path;
Soon, the file was successfully imported into the database, which was highly efficient.
Look at the Mysql-front, the data normal import, done!