I was in the process of restoring an sql dump to a newly created RDS mysql instance on AWS.

The dump was created with the following command:

--all-databases \
--single-transaction \
--compress \
--order-by-primary > dump.sql

During the restore process I lost connection to the RDS instance.

Can I simply restart the restore process of the dump by re-initiating the restore process?

Or, asking more generally:

What excactly happens when restoring an sql dump? Will already created tables simply be overwritten? Will the database delete old entries and copy over the new database state?

  • It depends on the parameters you included during the export of mysqldump – Koustuv Chatterjee Jan 25 '16 at 12:45
  • See the updated question @MySQLRockstar – jottr Jan 25 '16 at 13:30
  • There is an old but handy tool GNU Screen and newer tmux that allows to run long and critical jobs without risk to be interrupted by disconnect. – Kondybas Sep 15 '18 at 6:46

(n.b. I've never used AWS or RDS so there may be some differences). But as a general rule a MySQL DUMP file is just a series of CREATE TABLE and INSERT INTO statements, that when combined create your database.

Ultimately it depends on what options were chosen as to what does and doesn't get included. But I think that by default it includes the --add-drop-table option. So if you open the file (which is basically a text file) you should see:

DROP TABLE tablename;
CREATE TABLE tablename. . .
INSERT INTO tablename. . . 

for all of your tables.

Restarting the loading process will simply start from the beginning of the file and carry out the actions accordingly.

(I assume that the import has actually died - its not uncommon (in my experience) to lose connection to MySQL during the import due to the time taken, but the process continues in the background. You can use SHOW PROCESSLIST to check this).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.