Restore DB from backup

I've restored a backup for a site that's gone down. The DB has come as different files for each individual table. Is there a way to get a combined .sql to upload or a quicker way to put these back on the server rather than importing each table individually through PHPMyAdmin?

Can I just ZIP all these files and upload that via PHPMyAdmin?

  • Adam Czajczyk

    Hello Jon,

    I hope you're well today and thank you for your question!

    These are separate dumps of single database tables so you'd import them one by one via phpMyAdmin. I'm not sure how many tables there are but it's usually a "once off" process. Zipping them together will most likely not work (though I admit I never tried that) but you can actually merge them.

    A "manual" (thought I don't think it would be a time saver) option would be to create new text file with .sql extension and just copy and paste content of every single .sql file into it, one after another.

    A better way would be to "automate" it a bit so if you got these files all in a single folder you should be able to do this via a terminal. If you're on Windows you should be able to open a command line console and use a command like this (in a folder where you store these files):

    copy /b *.sql full_db.sql

    On Linux a similar command would work

    cat *.sql > full_db.sql`

    I'm not a Mac user and I'm not sure about similar command on Mac but I believe there should be an equivalent there too.

    Such "merged" full_db.sql file could then be imported in "one go" via phpMySql import.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.