关于使用myshell备份数据一些注意事项(1)

2024年 5月 23日 36.6k 0

昨天晚上,在翻看姚远老师的《MYSQL 8.0运维与优化》一书时,看到了myshell备份恢复工具这一节。里面介绍了如何用myshell备份恢复数据,有名话叫“纸上得来终觉浅,绝知此事要躬行”。

老师在课本讲的是头头是道,但我在做实验却碰了一鼻子灰。

我在做实验时,使用的是一台退出MGR集群节点的虚拟机。当时使用的用户是MGR用户,用户名为admin。

那就去这个admin用户登录myshell, util.dump_schemas(["test"],"datadump")

Acquiring global read lock

Global read lock acquired

Initializing - done

1 schemas will be dumped and within them 4 tables, 0 views, 7 routines.

Gathering information - done

All transactions have been started

Locking instance for backup

Global read lock has been released

Traceback (most recent call last):

 File "", line 1, in

mysqlsh.Error: Shell Error (52008): Util.dump_schemas: While 'Gathering information': U                 ser 'admin'@'%' is missing the following privilege(s) for schema `test`: EVENT.

从以上的最后一段提示看,说admin用户权限不足。那我们就授权给admin用户就行了。

我们将test数据库下面的一个表删除,接下来看看恢复效果。

然后,util.load_dump("datadump")

ERROR: The 'local_infile' global system variable must be set to ON in the target server                 , after the server is verified to be trusted.

Traceback (most recent call last):

 File "", line 1, in

mysqlsh.Error: Shell Error (53025): Util.load_dump: local_infile disabled in server

做数据库恢复时,报错。从提示看,我们要设置local_infile全局参数为ON。那我们就设置一下 set global local_infile=on。设置后,果然成功执行命令了。

关于使用myshell备份数据一些注意事项(1)-1

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论