Here we will learn how to restore the database from a backup using mysql commands
we need to follow the following steps for the process
- We must have a database dump that we want to restore on the machine with the correct
database name for which we are doing the restore process.
- Now we will load the backup file using the mysql command.
Lets say we have a dump for a database name test.sql
and we have a database test in the MYSQL Workbench or SQLyog.
Now we will use the following mysql command to restore our test.sql file to the test database.
$ mysql -u root -p test <test.sql
or
$ mysql -u root -p test < /var/www/html/myfolder/test.sql
Restoring the database from a compressed dump file we use the following command and we must have a database in the targeted machine for which we are restoring:
gunzip < [test.sql.gz] | mysql -u [uname] -p[pass] [dbname]
0 Comment(s)