当前位置: 移动技术网 > IT编程>数据库>Mysql > 运用mysqldump 工具时需要注意的问题

运用mysqldump 工具时需要注意的问题

2017年12月12日  | 移动技术网IT编程  | 我要评论
描述如下:
用mysqldump 导出 trigger 的时候遇到一个问题,贴出来,以免大家犯错。

在执行下面的操作时:
复制代码 代码如下:

[root@ytt ~]# /usr/local/mysql/bin/mysqldump -s /tmp/mysql1.sock test > test.sql

导出的结果里面含有 trigger.
复制代码 代码如下:

[root@ytt ~]# /usr/local/mysql/bin/mysqldump -s /tmp/mysql1.sock -rdtn test > test_sp.sql

导出的结果里面仍然含有 trigger.
导入的时候出错:

[root@ytt ~]# /usr/local/mysql/bin/mysql -s /tmp/mysql1.sock --database test < test.sql
[root@ytt ~]# /usr/local/mysql/bin/mysql -s /tmp/mysql1.sock --database test < sp.sql
error 1235 (42000) at line 26: this version of mysql doesn't yet support 'multiple triggers with the same action time and event for one table'


解决办法:

默认不带任何参数的时候 tiggers 值为真,那么我们修改他的值为假,给mysqldump 加上开关: --triggers=false 即可。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网