How to restore MySQL database from sql dump file

We know how to grant a remote access to a single MySQL database and create the backup. Let’s try to restore our data. There are two ways to restore your MySQL database from sql dump file.
The easiest way to restore MySql Database from SQL Dump file is to use Web control panel of PhpMyAdmin.
Do not use phpMyAdmin to import or restore your MySQL database if your MySQL database file is large. This is because, phpMyAdmin has limit on total upload size which depend on php setting. Besides, there is also maximum execution time which may cause browser to time out.
The solution for restoring large mysql database from sql dump file is using unix/linux shell command. To restore mysql database from a dump file, just type the command below:

mysql -u #username# -p #database# < #dump_file#

Of course you need to replace #username# to your database username, #database# to your target database and #dump_file# to your dump file file name (e.g. “dump.sql”).

Once you enter the command, the linux/unix shell will prompt you for your database user password, just type your database password in and here you are!

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>