MySQL database dump is a procedure for backing up a file that contains instructions in SQL language. These instructions allow you to exactly reproduce the copy of your database as it was at the time the dump was created. The need to create a SQL Dump may arise in two cases:
Similarly, you can also replace an existing database if needed.
The first way - with the help of phpMyAdmin. This tool is preinstalled in all CMS without exception, so it is the most convenient one. So, to export the database in .sql extension, you need:
After that, it remains to wait until the system completes the creation of a dump of the database on your computer. The resulting file in .sql format you can later import through the appropriate tab in the same phpMyAdmin panel.
The second way - dumping by using the console. At first glance it may seem that this is a more complex option, but in fact it takes much less time. The algorithm is as follows:
To make things clear, let's explain:
Everything is very simple and straightforward. Well, to restore the database from the dump, the created file can be similarly imported through the console. To do this, enter the command "mysql -u[mylogin] -p[secretpassword] -f mydb < mydb_dump.sql".
Now you know how to dump a MySQL database, and if you need to, you can easily export and then import the file with the .sql extension from one server to another.