How to Restore a Dump File from MySQLdump

How do I restore a dump file from mysqldump?

It should be as simple as running this:

mysql -u  -p < db_backup.dump

If the dump is of a single database you may have to add a line at the top of the file:


If it was a dump of many databases, the use statements are already in there.

To run these commands, open up a command prompt (in Windows) and cd to the directory where the mysql.exe executable is (you may have to look around a bit for it, it'll depend on how you installed mysql, i.e. standalone or as part of a package like WAMP). Once you're in that directory, you should be able to just type the command as I have it above.

How do I restore a dump file from mysqldump using kubernetes?

What I did was this:

  • Create an NFS mount with two sub0drectories: mysql and initd.
  • In initd, I added several ,sql files, including the dump.
  • Mount initd as /docker-entrypoint-initdb.d in the deployment.This causes all the files to be read at initialisation time provided that it is the first time we run.
  • The mysql directory is mounted as /var/lib/mysql and contains all the mariaDB files.

If I need to revert, I trash all the contents of the mysql directory and re-create the deployment.

MySQL : Restore dump file

Conducted a backup of the following.

mysqldump -u xxx -p --all-database > c:\data.sql

Or, in the database unit

mysqldump -u xxx -p --databases db_name > c:\data.sql

Recovery in the following code.

mysql -u root -p < c:\data.sql

Restore MYSQL Dump File with Command Line

When I execute the answers of this thread, it returns 'mysql' is not recognized as an internal or external command, operable program or batch file..

Turned out that I have to execute mysql.exe first in xampp/mysql/bin folder, and the dump file path is relative to this bin folder. I put mine in there, and it worked.

Thanks all.

How to restore Mysql Backup from dump file?

If it's a dump file that you created using mysqldump, then you can build a new database from the dump file using the source command. Just login to MySQL using mysql -p, enter the root mysql password, then type: source /path/to/mysqldumpfile

Mysqldump - How to restore a single table from this file?

u can try it

mysql -u root -p databasename -h localhost < copyPasteFile.sql 

Related Topics

Leave a reply