自己的数据库数据分区
我不认识你,但我,当我决定重新安装操作系统时,我已经多次丢失数据库数据...
是的,我知道……请不要说出来。
所以我不是第一次考虑将自己的分区给数据库数据(/var/lib/mysql)。确实我做过一次,但现在我不记得为什么了,没有按预期工作。 重装WP、Joomla、下载客户数据就没那么好玩了。
有什么想法可以解决这个痛苦的问题吗?
谢谢。-
I don't know you but I, I have lost DB data several times when I decide reinstall an OS...
Yes, I know... please don't say it.
So is not first time that I think in give his own partition to the DB data (/var/lib/mysql). Indeed I did it one time, but now I don't remember why, did not worked as expected.
Reinstall WP, Joomla, download customer data is not so fun.
Any idea to solve this painful issue?
THX.-
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是在重新安装操作系统之前使用 mysqldump 进行备份,然后将其导入回来。
也就是说,将 MySQL 数据放在单独的分区上是一个好主意。为此,您首先需要为其创建一个分区。一旦你有了一个分区并安装了它,你可以将 /var/lib/mysql/* 复制到它
现在编辑你的 my.cnf 以指向不同的数据目录
确保你的权限正确并重新启动 MySQL。
The simplest way would be to backup before re-installing the OS with mysqldump and then import it back.
That said, putting MySQL data on a separate partition is a good idea. For that first you need to make a a partition for it. Once you have a partition and it's mounted you can copy /var/lib/mysql/* to it
Now edit your my.cnf to point to a different data directory
Make sure your permissions are correct and restart MySQL.
任何服务器都应该有一个完整的备份脚本,用于保存重新安装服务器所需的所有数据。不是专门用于重新安装,而是用于紧急情况,即您的硬盘驱动器出现故障。
如果您有完整的备份脚本,您也可以在重新安装服务器之前使用它进行完整备份。
编辑:顺便说一句,对于您的客户来说也是如此 - 不要等到您的第一次硬盘崩溃才以艰难的方式学习它......
Any server should have an complete backup-script that saves all needed data to reinstall your server. Not specially for reinstall, but for the case of emergency, that your harddrive fails.
If you have an complete backup-script, you can use that also for an complete backup before you reinstall your server.
Edit: The same for your client btw - don't wait for your first hdd-crash to learn it the hard way...