Click to See Complete Forum and Search --> : Quick mySQL question..
SonicSnoop
08-16-2002, 10:32 PM
I need to format my linux machine and have a couple mysql databases that i would like to quickly backup and beable to quickly restore once i have reinstalled mysql.. can someone give me the commands to do this? I qould greatly apprecheate it.. I need to back up everything entire database tables and all content in them.. Thanks!
Going from mandrake to LFS on my server after installing LFS on my laptop..
If your mysql server is shut down when you do the backup, and is also shut down when you do the restore, you can just copy the files.
Otherwise use mysqldump. To pull a backup out of a running mysql server, do something like...
mysqldump --opt -uusername -ppassword dbname > outputfile
And instead of dbname, you can also put --all-databases. Restoring a db from such an output file is as easy as...
mysql -uusername -ppassword dbname < outputfile
SonicSnoop
08-17-2002, 09:21 PM
Thank you very much! The backup worked great! wont know about the restore until i get my system reinstalled but it appears like it would work just as easy as you said.. if not i at least have all the info in that file from the backup just take alot of hard data entry.. :) (copy paste) hehe but dont htink ill have to go that route.. Thanks again! Take care...