Part 3: Back Up and Restore a MySQL Database
On a MySQL Database server, the databases stores valuable and crucial information, we take regular backups of the database,so that the data can be restored in case of disaster or for recovery purposes. Here we are going to user MySQL dump utility to take the backup of MySQL server databases on Linux Server.
The mysqldump utility has advantages and disadvantages. The advantages of using mysqldump are that it is simple to use and it takes care of table locking issues for you. The disadvantage is mysqldump locks tables. If the size of your tables is very big mysqldump can lock out users for a long period of time.
Suggestable Read: MySQL Server installation on CentOS/RHEL 7
Also Read : MySQL basic commands & Database Creation
1. TAKE DATABASE BACKUP
[root@techinformant_db ~]# mysqldump -u root -p mylabdb > /db_back/mylabdb_backup.sql
Note : Always Keep your DB dump file encrypted
2. RESTORE DATABASE BACKUP
Optional Step : if your Database Dump File is encrypted
Restore the Database
Conclusion: I hope this article helps you take back up and restore the MySQL databases on Linux Server. Please follow our next articles to know about troubleshooting the MySQL and forgotten MySQL login password.