关于使用 mysqldump 备份 MySQL DB 的问题
如果我要使用 mysqldump 创建 MySQL 数据库备份,并使用 PHP“系统”或类似函数调用它,我必须在行中包含密码,以便使其自动化。
然后,我可以(例如)手动调用 php 函数(即通过链接)或将其作为 cron 作业运行。
我的担忧:
鉴于数据库位于 Ubuntu(服务器)或其他 Linux 版本上,这不是一个坏主意,因为下一个登录服务器的人会识别该数据库密码?
显然,我们不是在讨论 root 密码。所以问题的第二部分是,可以向仅用于备份的用户帐户授予什么权限?
感谢分享!
If I were to create a MySQL DB backup using mysqldump, and call it using a PHP 'system' or similar function, I have to include the password in the line, in order to automate it.
I can then (for example), either call the php function manually (i.e, through a link) or run it as a cron job.
My concern:
Given that the DB is on Ubuntu (Server), or another Linux flavour, wouldn't this be a bad idea since the next person logging in to the server will recognise the DB password?
Obviously, we're not talking about the root password. So the second part of the question is, what privileges could be given to a user account that would only be used to do backups?
Thanks for sharing!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将密码放入具有适当锁定权限的文件中,然后执行
以下操作: 至少,您需要 SELECT、LOCK_TABLES,如果您处于复制情况并且需要刷新日志,则可能还需要 RELOAD。
You can put the password into a file with appropriately locked-down privileges, then do
At minimum, you'd need SELECT, LOCK_TABLES, and possibly RELOAD if you're in a replication situation and need to flush logs.
对于您的实际应用程序,您不会将数据库密码放在 PHP 文件(或 ini 文件)中吗?
你没有安装 phpmyadmin (在它的配置文件中你可以看到未加密的密码)?
Wouldn't you put the DB password in a PHP file (or ini file) anyway for your real application?
Don't you have a phpmyadmin installed (and in it's configuration file you can see the passwords un-encrypted)?