I've backed all my mysql databases with he following command
mysqldump -u root -ppasswod --all-databases | gzip > all.sql.gz
just wanted to know will I be able to restore all of the database with following command
gunzip < alldb.sql.gz | mysql -u root -ppassword -h localhost
can you also tell me how to back up all of mysql users too?
I cant test it because I'm not sure and I don't want to break any db on my current system
Under the full recovery model, after you restore your data backup or backups, you must restore all subsequent transaction log backups and then recover the database. You can restore a database to a specific recovery point within one of these log backups.
Connect to the appropriate instance of the SQL Server Database Engine, and then in Object Explorer, select the server name to expand the server tree. Right-click Databases, and then select Restore Database. The Restore Database dialog box opens. Select the database to restore from the drop-down list.
Yes. Generally, to restore compressed backup files you can do the following:
gunzip < alldb.sql.gz | mysql -u [uname] -p[pass] [dbname]
Please consult How to Back Up and Restore a MySQL Database
Note that the --all-databases
option is applicable to backup only. The backup file itself will contain all the relevant CREATE DATABASE quux;
commands for the restore.
This is the command I use to backup all databases in MySQL:
mysqldump -u USERNAME -p --all-databases --events --ignore-table=mysql.event --extended-insert --add-drop-database --disable-keys --flush-privileges --quick --routines --triggers | gzip > "all_databases.gz"
To restore from a *.gz mysqldump file:
gunzip < all_databases.gz | mysql -u USERNAME -p
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With