To perform various backup operations of MySQL databases using mysqldump command and also we will see how to restore them with the help of mysql and mysqlimport command in Linux.
How to Restore MySQL Database?
To take the backup of databases, now we will see how to restore them using following format.
[root@localhost]# mysql -u [username] –p[password] [database_name] <[dump_file.sql]
How to Restore Single MySQL Database?
To restore a database, you must create an empty database on the target machine and restore the database using msyql command.
[root@localhost]# mysql -u root -p pass123 monitor < monitor.sql
If you want to restore a database that already exist on targeted machine, then you will need to use the mysqlimport command.
[root@localhost]# mysqlimport -u root -p pass123 monitor < monitor.sql