Jump to content
The mkiv Supra Owners Club

Backing up/restoring MySQL databases?


Thorin

Recommended Posts

You can either do a mysqldump, or a mysqlhotcopy, or shut down the mysql instance and copy the datafiles. Copying running datafiles is hazardous and not to be recommended.

 

Ok I'll stop that then :innocent:

 

Cheers for the link Pete, I was lazy and thought I'd get a quick response on here. I'll have a go with this mysqldump thing...

Link to comment
Share on other sites

mysqldump is quickest and easiest I believe :D (well it is what I do here anyway).

 

mysqldump -u user -h host database > databasedump.sql

 

lots of funky options with that too, but to restore you simply have to either drop your db and recreate from the mysql instance, then from the command line something like:

 

mysql -u user -h host

 

(depending on specifics of your setup)

Link to comment
Share on other sites

To back up MySQL you usually have the option of backing up the table structures, the data itself, or both.

 

You can have the structure dumped into a text file and run it as a form of INSERT query when you need to.

 

I wanted to add it's probably not a good idea just copying the data folder, you will have the data, but you will probably lose the table structures and you would end up having to recreate these manually (!) if you don't already have a backup.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.