As part of a system rebuild of my local machine, I have exported all of my MySQL databases using the Export tab in phpMyAdmin. The result is one large file containing each database and their respective tables.

My setup is a MacBook running MAMP 3 Pro

Upon trying to restore the databases, I am running into a problem where phpMyAdmin seems to want the each of the databases to be created first. A typical error message is:

Error SQL query:

-- Database: myfirstdatabase

1046 - No database selected

I have clearly gone about backing up my databases in the wrong way, but is there a method for easily recovering from this situation?

1 Answer 1


When exporting, phpmyadmin has an option (under the "custom" configuration) to "CREATE DATABASE / USE statement". If you didn't check that, then your export file won't create the databases.

As far as recovering, you'll need to create each database manually. Not the tables and schemas though, just create the database itself and your existing default export format should create the tables for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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