mysqldump: Got error: 1356 mysqldump的重要参数--force
一个MySQL的备份突然变小了很多,但实际的数据量却一直在增长。备份脚本也没有调整过。为什么呢?
重现了一下备份过程,发现备份中遇到了如下错误:
mysqldump: Got error: 1356: View 'wordpress.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them when using LOCK TABLES
原因: 视图引用的表不存在。
原理:mysqldump在备份时要对表加读锁,加锁失败的时候。备份就终止了。
解决方法:在备份时加上--force参数
模拟测试如下:
正常情况:
1.创建表t1并插入数据
CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into t1 values(1,3,5);
2.基于表t1创建视图
create view v_t1 as select * from t1;
3.模拟备份,可以正常备份出数据
mysqldump -ubkpuser -ps3cret wordpress>wordpress.sql
模拟视图引用的表被删除:
1.删除表t1
mysql> drop table t1;
Query OK, 0 rows affected
mysql> select * from v_t1;
1356 - View 'wordpress.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
2. 模拟备份,失败
$mysqldump -ubkpuser -ps3cret wordpress >wordpress1.sql
Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1356: View 'wordpress.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them when using LOCK TABLES
3. 增加force参数后,虽然有错误,但不影响备份
$mysqldump -ubkpuser -ps3cret --force wordpress >wordpress1.sql
Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1356: View 'wordpress.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them when using LOCK TABLES
mysqldump: Couldn't execute 'SHOW FIELDS FROM `v_t1`': View 'wordpress.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)
[clouder@server2-86 ~]$ /home/clouder/vs/program/mysql/bin/mysqldump -uroot -p11 -S /home/clouder/vs/program/mysql/run/mysql.sock -h 172.16.2.86 --all-databases --master-data=1 --flush-logs --force > /home/clouder/backup/alldatabase`date +%F-%H-%M-%S`.sql
mysqldump: Couldn't execute 'SHOW FIELDS FROM `ApiCommandAliasView`': View 'api.ApiCommandAliasView' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)
mysqldump: Couldn't execute 'SHOW FIELDS FROM `ApiReset`': View 'api.ApiReset' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)
mysqldump: Got error: 1356 mysqldump的重要参数--force的更多相关文章
- mysqldump 使用--tab=path参数时提示mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'
报错: [root@zedu test]# mysqldump -h127.0.0.1 -uroot -p --single-transaction --add-drop-database --tab ...
- mysqldump: Got error: 1045
问题:最近备份mysql然后在执行mysqldump的时候提示权限和密码有问题 报错: Warning: Using a password on the command line interface ...
- mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' when using LOCK TABLES
AutoMySQLBackup备份时,出现mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@' ...
- mysqldump: Got error: 1556: You can't use locks with log tables. when using LOCK TABLES
mysqldump: Got error: 1556: You can't use locks with log tables. when using LOCK TABLES 我是把一些mysqldu ...
- mysqldump: Got error: 1135: Can't create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug when trying to connect 解决办法
在进行数据库备份的时候发现服务器报 mysqldump: Got error: 1135: Can't create a new thread (errno 11); if you are not o ...
- (转)mysqldump: Got error: 1556: You can't use locks with log tables.
mysqldump: Got error: 1556: You can't use locks with log tables. 原文:http://blog.51cto.com/oldboy/112 ...
- mysqldump: Got error: 1449: The user specified as a definer ('user'@'%') does not exist when using LOCK TABLES
报错:一个库用mysqldump -u -p --opt --force -e --max_allowed_packet= --net_buffer_length= --databases备份时报错如 ...
- 解决mysqldump: Got error: 1044: Access denied for user
转自:http://blog.slogra.com/post-512.html 今天给新加的几个数据库备份,在执行mysqldump的时候,居然报mysqldump: Got error: 1044: ...
- mysql数据库导出时报错mysqldump: Got error: 145的解决方法
在给mysql数据库备份时,报错:mysqldump: Got error: 145: Table './jxzhtopenfire/ofoffline' is marked as crashed ...
随机推荐
- HDU1114(KB12-F DP)
Piggy-Bank Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- MySQL常用操作汇编
熟悉 我熟悉xxx,其实很多原来熟悉到能背的,如果长时间不用了几乎也就忘了.此时再说自己熟悉XXX就被认为是在吹牛B了,感觉不是很好.所谓温故而知新,对于天资不聪颖的,就是要在一遍一遍的复习实践中慢慢 ...
- 常用,好用的js代码
记录看到或者用到的js代码,长期更新! 判断是否是正整数 (number-0)|0 !== number-0 解析: number-0 转换成数字,再通过位移运算(|)判断是否跟原数字相等 安全检查j ...
- How to use Data Iterator in TensorFlow
How to use Data Iterator in TensorFlow one_shot_iterator initializable iterator reinitializable iter ...
- Python网络爬虫笔记(一):网页抓取方式和LXML示例
(一) 三种网页抓取方法 1. 正则表达式: 模块使用C语言编写,速度快,但是很脆弱,可能网页更新后就不能用了. 2. Beautiful Soup 模块使用Python编写,速度慢. ...
- Python笔记(九):字符串操作
(一) 字符串 单引号.双引号.三重引号都可以作为字符串的开始和结束,三重引号可以直接输入多行字符串.三重引号可能一般是用来写多行注释. (二) r和\ r使字符串成为原始字符串,忽略所有 ...
- JAVA将list转化为xml文件
pojo类: public class TreeNode { private int id; private String nodeId; private String parentId; priva ...
- svn目标计算机主动拒绝
这两天上传文件到服务器端,总是提示“ 目标计算机主动拒绝”. 后来排查,是受到360杀毒软件的文件系统实时防护功能影响. 虽然服务器端已经将仓库目录添加进360杀毒的白名单,但随着用户不断更新文件,文 ...
- 【SPL标准库专题(9)】 Datastructures:SplObjectStorage
PHP SPL SplObjectStorage是用来存储一组对象的,特别是当你需要唯一标识对象的时候. PHP SPL SplObjectStorage类实现了Countable,Iterator, ...
- 推荐linux下的数据库开发工具DBeaver 开源免费
linux下不错的数据库管理工具 DBeaver 操作比较友好,基于eclipse.使用jdbc链接,链接数据库非常全(oracle mysql mssql sqlite 常见的统统支持).而且可以 ...