Own partition for database data
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 g开发者_StackOverflowive 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.-
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
cp /var/lib/mysql/* /new/partition/mysql/
Now edit your my.cnf to point to a different data directory
datadir = /new/partition/mysql
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...
精彩评论