Restoring a mysql backup
This is solution restore single MySQL Database from that backups.
Before you restore a database, you must create an empty database on the target machine and restore the database using msyql command. For example the following command will restore the restore_backup.sql file to the rsyslog database.
# mysql -h localhost -u root -pazzazy(this is pass root you setup) restore_backup < restore_backup.sql
If you want to restore a database that already exist on targeted machine, then you will need to use the mysqlimport command.
# mysqlimport -u root -pazzazy(this is pass root you setup) restore_backup < restore_backup.sql
In the same way you can also restore database tables, structures and data.
In Case with file sql.gz you can restore with command:
gunzip < test.sql.gz | mysql -u [uname] -p[pass] [dbname]
And Please you can read Backup and Restore Database .gz
Mohamed Azzazy
Updated on September 18, 2022Comments
-
Mohamed Azzazy over 1 year
Hello i am using a vps running ubuntu 1604 and i have done this Automatic backup of mysql on ubuntu but i want now to restore that backup Thanks in advance
-
George Udosen almost 7 yearsAre you using
phpmyadmin
console? -
Mohamed Azzazy almost 7 yearsdisabled it but i can enable.
-
George Udosen almost 7 yearsHow were you planning on restoring database from command line, I believe the console is better
-
EODCraft Staff almost 7 years
-
-
Rinzwind almost 7 yearsUnsafe. That will echo the password to the processlist.
-
Tannetto almost 7 yearsYes, with command maybe not show password and remove option` -pazzazy`. So when restore database you can login password when run command.
-
Mohamed Azzazy almost 7 yearsmy database format is sql.gz i dont think that this will work.
-
Tannetto almost 7 yearsWith database format is sql.gz you can use backup all database sql with command gzip. I'm update command backup and restore with sql.gz.