Recently, I got a MySQL script file of dozens of MB, which is ready to be restored to a database.
Recently, I got a MySQL script file of dozens of MB, which is ready to be restored to a database.
Recently, I got a MySQL script file of dozens of MB, which is ready to be restored to a database.
I used MySQL-Front for a short time. I tried it first and the result was suspended.
In this case, first create an empty database and then use the mysql command line to import it.
1) An empty database is created using MySQL-Front.
Because all objects in the script have commands, select gbk for the character set.
2) Start MySQL command line and enter the password
3) use the new database B
Enter the following command:
4) Changing the File Reading character set to utf8 is critical.
At the beginning, the following command is used to set it to gbk:
Set names gbk;
However, during import, all errors are caused and Chinese characters cannot be recognized.
Later I 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 VS.net IDE, save it as, and select "Save encoding"
The character set is UTF-8;
So
Enter the following command:
5) Import files
Enter the following command:
Soon, the file is successfully imported into the database, which is highly efficient.
Go to MySQL-Front and check that the data is imported normally!