免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3396 | 回复: 3
打印 上一主题 下一主题

mysqldump的导表权限问题; [复制链接]

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2016-05-27 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-05-20 16:07 |只看该作者 |倒序浏览

求助mysqldump的导出表的权限的问题,如在进行如下导表操作的时候

mysqldump -uuser  -p  --tables  dbname tablename > a.sql
提示:
mysqldump: Got error: 1044: Access denied for user 'user'@'localhost' to database 'dbname' when doing LOCK TABLES

然后我看了下我这个用户的权限
mysql> show grants for user@'localhost' ;
+----------------------------------------------------------------------------------------------------------------------+
| Grants for user@localhost                                                                              
+----------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, DROP ON *.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD 'XXXXXXXXXXX' |
+----------------------------------------------------------------------------------------------------------------------+

求教

1. 数据库的root用户,需要给这个user用户分配啥权限,才可用user这个用户来dump表数据呢?
2. 另外,mysqldump有没有啥参数,可以在导出表的时候,不要 lock整个table  ??

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2016-05-27 06:20:00
2 [报告]
发表于 2015-05-20 16:10 |只看该作者
换言之,只能是mysql的root用户,才可以导出表数据么?

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2016-05-27 06:20:00
3 [报告]
发表于 2015-05-20 16:27 |只看该作者
最后在mysql官网上找到结论了。


mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, and LOCK TABLES if the --single-transaction option is not used. Certain options might require other privileges as noted in the option descriptions.


--single-transaction

This option sets the transaction isolation mode to REPEATABLE READ and sends a START TRANSACTION SQL statement to the server before dumping data. It is useful only with transactional tables such as InnoDB, because then it dumps the consistent state of the database at the time when START TRANSACTION was issued without blocking any applications.

求职 : Linux运维
论坛徽章:
203
拜羊年徽章
日期:2015-03-03 16:15:432015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:57:092015小元宵徽章
日期:2015-03-06 15:58:182015年亚洲杯之约旦
日期:2015-04-05 20:08:292015年亚洲杯之澳大利亚
日期:2015-04-09 09:25:552015年亚洲杯之约旦
日期:2015-04-10 17:34:102015年亚洲杯之巴勒斯坦
日期:2015-04-10 17:35:342015年亚洲杯之日本
日期:2015-04-16 16:28:552015年亚洲杯纪念徽章
日期:2015-04-27 23:29:17操作系统版块每日发帖之星
日期:2015-06-06 22:20:00操作系统版块每日发帖之星
日期:2015-06-09 22:20:00
4 [报告]
发表于 2015-05-20 23:11 |只看该作者
解决了就好
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP