没有不值得去解决的问题,也没有不值得去学习的技术!

Import Large SQL Files With MySQL Query Browser

During execution, the Execute button is grayed out and cannot be clicked again, and an execution progress prompt is displayed

1. Since the overly large SQL file could not be imported in phpMyAdmin, I decided to import it in MySQL Query Browser, as shown in Figure 1.

Since the overly large SQL file could not be imported in phpMyAdmin, I decided to import it in MySQL Query Browser
Figure 1

2. The SQL file size is 186MB, as shown in Figure 2.

The SQL file size is 186MB
Figure 2

3. Click the Execute button to run the script, as shown in Figure 3.

Click the Execute button to run the script
Figure 3

4. During execution, the Execute button is grayed out and cannot be clicked again, and an execution progress prompt is displayed, as shown in Figure 4.

During execution, the Execute button is grayed out and cannot be clicked again, and an execution progress prompt is displayed
Figure 4

5. Execution error: You have an error in your SQL syntax, as shown in Figure 5. Execution error: You have an error in your SQL syntax, as shown in Figure 5.

Script line: 182467 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”<p style=\”padding:0px;line-height:26px;color:#333333;font-family:&#39;open san’ at line 1

Execution error: You have an error in your SQL syntax
Figure 5

6. The reason is that the SQL file itself contains errors and was not fully imported. Out of a total of 334,242 lines, an error exists at line 182,467, which halted the import, as shown in Figure 6.

The reason is that the SQL file itself contains errors and was not fully imported. Out of a total of 334,242 lines, an error exists at line 182,467, which halted the import
Figure 6

7. Delete line 182,467, as shown in Figure 7.

Delete line 182,467
Figure 7

8. Analyzing line 182,467 reveals that the S� keyword caused the import to halt. You can search for lines containing S�, delete them all, and then continue the import until the entire SQL file is successfully imported, as shown in Figure 8.

Analyzing line 182,467 reveals that the S� keyword caused the import to halt. You can search for lines containing S�, delete them all, and then continue the import until the entire SQL file is successfully imported
Figure 8

9. A total of 334,084 lines were fully imported, as shown in Figure 9.

A total of 334,084 lines were fully imported
Figure 9

10. Click the Execute button again to run the script. The execution succeeds, as shown in Figure 10.

Click the Execute button again to run the script. The execution succeeds
Figure 10

11. This approach still has drawbacks: the operational steps are too cumbersome, and support for certain special characters is inadequate. Ultimately, I decided to use SQL commands to import the SQL file. Start the MySQL client, as shown in Figure 11.

Use SQL commands to import the SQL file. Start the MySQL client
Figure 11

12. Execute the following commands in sequence, as shown in Figure 12:
show databases;
use kaiqiu;
show tables;
source C:/Users/Administrator/Downloads/gdm.sql;

Execute the following commands in sequence
Figure 12

13. The SQL file size is 303MB, as shown in Figure 13.

The SQL file size is 303MB
Figure 13

14. Checking in phpMyAdmin confirms the import was successful, as shown in Figure 14.

Checking in phpMyAdmin confirms the import was successful
Figure 14

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系