我正在尝试导出受 SSH key 和专用网络保护的数据库,这意味着我无法登录主机本身以在本地运行 mysqldump,并且 ssh -i“key” 不起作用我也远程运行它。
我看到的唯一选项是通过 Workbench 连接并从那里转储它,但是当我尝试转储时,我收到 PROCESS privelage 错误。据我研究,可以通过在 mysqldump.exe 上使用 --no-tablespaces 标志来规避它,因此我正在寻找一种添加它的方法,以便 Workbench 可以使用该标志调用 mysqldump.exe。
我发现 MySQL 可以读取配置文件 my.cnf 和 my.ini,但我不知道要在其中写入什么来作为 --no-tablespaces 替代方案。
最佳答案
“MySQL Programs / Using MySQL Programs / Specifying Program Options / Using Option Files”页面包括:
Most MySQL programs can read startup options from option files (sometimes called configuration files). Option files provide a convenient way to specify commonly used options so that they need not be entered on the command line each time you run a program.
To determine whether a program reads option files, invoke it with the
--help
option. (Formysqld
, use--verbose
and--help
.) If the program reads option files, the help message indicates which files it looks for and which option groups it recognizes.
在 syntax section ,您可以看到一个 [mysqldump]
header 。
因此,请检查将 header+option 添加到您的 my.cnf
或 my.ini
是否足够:
[mysqldump]
no-tablespaces
It complained that I need Reload permission which I couldn't find any way to get around, I don't have access to grant any privileges.
如果您没有必要的权限并且无法将这些权限授予您的用户,那么您可以做的事情会受到一些限制。但是,您可以尝试以不同的方式导出数据库,而无需您缺少的权限。
一种方法是使用 mysqldump
命令行实用程序,但有选择地转储数据库的数据和结构,而不尝试转储任何需要更高权限的其他信息。
例如:
mysqldump -u yourUsername -p --no-tablespaces --skip-triggers --routines --events --compact yourDatabaseName > yourDatabaseName.sql
请注意,通过使用这些选项,您可能无法获得数据库的全保真转储(例如,它可能不包含触发器)。
如果您绝对必须使用 MySQL Workbench 并且遇到权限问题,您可能需要联系数据库管理员以授予您所需的权限或要求他们为您执行转储。
关于mysql - 如何在使用 Workbench 时添加 mysqldump 配置标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76557146/