MySQL:导入时忽略错误? [英] MySQL: ignore errors when importing?

查看:1907
本文介绍了MySQL:导入时忽略错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在导入一个相当大的数据库。 .sql 文件中包含近1,000,000行。问题是我在尝试导入数据库时​​遇到语法错误。它说:

I am importing a fairly large database. The .sql file has almost 1,000,000 lines in it. Problem is that I am getting a syntax error when trying to import the database. It says:


ERROR 1064(42000)第8428420行:您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在'

致命错误附近使用正确的语法:
超过600秒的最大执行时间

ERROR 1064 (42000) at line 8428420: 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 '
Fatal error: Maximum execution time of 600 seconds exceeded in

通常我只是打开.sql文件并修复错误。但我的电脑真的很难打开这个文件。

Normally I'd just open the .sql file and fix the error. But my computer is really struggling to open this file.

导入MySQL数据库时有什么方法可以忽略错误吗?

Is there any way I can ignore errors when importing a MySQL database?

推荐答案

在mysql导入中使用 - 强制 -f )标志。 MySQL不会停止在有问题的声明上,而是继续将错误记录到控制台。

Use the --force (-f) flag on your mysql import. Rather than stopping on the offending statement, MySQL will continue and just log the errors to the console.

例如:

mysql -u userName -p -f -D dbName < script.sql

这篇关于MySQL:导入时忽略错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆