All Collections
Backups
How to (manually) restore a MySQL Dump backup
How to (manually) restore a MySQL Dump backup

This article will help you find out how you can manually restore a MySQL Dump backup

Brent Sanders avatar
Written by Brent Sanders
Updated over a week ago

In order to restore a MySQL Dump backup to the database it came from you'll first need to obtain the backup file either by downloading from Ottomatik or from your Archive's cloud storage provider (i.e. Amazon S3).

Get the backup file to your server:

If you normally SSH into your server you can use SCP to transfer the file to the server with a command similar to the following:

scp myd.2020.ottomatik.20150629_050005.sample.sql.gz user@someserver.com:/tmpΒ 

This command would transfer the file myd.2020.ottomatik.20150629_050005.sample.sql.gz using the SSH login user to the server at someserver.com and place the file in the /tmp directory.

At this point you'd now need to SSH into this server and navigate to the /tmp directory (or wherever you put the file) and decompress the file. The backup file is compressed using"gzip" so it can be uncompressed using the "gunzip" command.

gunzip myd.2020.ottomatik.20150629_050005.sample.sql.gz

Now you should have a .sql file in the same directory ready to be restored to the database.

Restoring the backup

To restore the backup file you can use a mysql command like the following:

mysql -u dbuser -p sample < /path/to/myd.2020.ottomatik.20150629_050005.sample.sql

This command will use the database user dbuser and restore the file located at /path/to/myd.2020.ottomatik.20150629_050005.sample.sql to the database called sample.

This command assumes you are SSH'd into the server running the database. If not you could alter the command to be similar to:

mysql --user=dbuser --host=foo.com --port=3306 -p sample < /path/to/myd.2020.ottomatik.20150629_050005.sample.sql

This will specifically instruct the command on which host and port to run the restore command on.

πŸŽ‰πŸŽ‰πŸŽ‰

We hope you find this helpful! If you need any further assistance, please contact us and we'll be more than glad to help you out.Β 

Did this answer your question?