即使 MySQL 工作台中出现错误,也可以继续 SQL 查询
我正在使用 MySQL 工作台将 Joomla sample_data.sql 文件导入到我的本地数据库中。我希望它能够通过跳过导致错误的行来继续导入,即使发生错误也是如此。
我可以在 SQL 前面添加一些前缀来防止查询因任何错误而停止吗?
I'm using MySQL workbench to import a Joomla sample_data.sql file into my local database. I want it to continue importing, even if an error occurs, by skipping the line that caused the error.
Is there something I can prefix the SQL with to prevent the query from halting at any errors?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试
Mysql 帮助部分说
try
Mysql help section says
您还可以使用
INSERT IGNORE
You could also use
INSERT IGNORE
在 MySQL Workbench 中,我取消选中“查询时停止脚本执行错误”选项:
它看起来像Zimbabao 的答案也将有效。
在较新的版本中,使用“切换 SQL 脚本的执行是否应在失败的语句后继续”
In MySQL Workbench, I unticked the option under Query to "Stop Script Execution on Errors":
It looks like Zimbabao's answer will work also.
In newer versions use 'Toggle whether execution of SQL script should continue after failed statements'