By -
陳 思敬
MySQL 备份失败
前两天处理不被信任的用户,才发现封禁只是禁止编辑,被封禁的用户,仍然可以登录系统,查看被限制的内容。于是想着直接操作数据库,删除用户,但备份数据库时,发现权限问题。
$ mysqldump -uwiki -p adpub > /home/christen/wiki-db.sql
-bash: /var/www/adpub.132010.com/bak-db.sql: Permission denied
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Error: 'Access denied; you need (at least one of) the privilege(s) for this operation' when trying to dump tablespaces.
这里可能涉及到两个权限:
- mysqldump 有没有权限在输出目录写文件;
- 其它我还没有整明白的权限。
在此之前,MediaWiki 多次备份重装,没有发现这个问题,可能是MySQL 版本升级之后,额外追加的安全控制。
如果输出目录可以写文件,比如 /tmp/ 或者 /home/christen/,数据库似乎备份成功,但是权限失败的提示让人放心不下。
求助老扬,他找了一个帖子,解决了这个问题,似乎是MySQL版本的功能限制。
- Updating the privileges for your database user.
- Runing
mysqldump
with the--no-tablespaces
option.
用第二个方案,备份成功。
mysqldump --no-tablespaces -uwiki -p adpub > /home/christen/wiki-db.sql
Tagged : 研发
1 thought on “MySQL 备份失败”
陳 瞽鱦 January 12, 2023 at 2:59 pm
封禁之后仍可登录的解决方案:
$wgBlockDisablesLogin = true;
Reply