0

A few days ago, I exported a .SQL dump file with all my databases, which is about 150MB. The thing is I cannot import it through phpMyAdmin since the file is way to big.

I remembered there was BigDump and I tried to use it, since it's ideal for such big imports as mine. The problem is that I need to set a database to import the dump file on, which is something I cannot do, since the dump file contains some databases I dumped, meaning that BigDump needs a database to be configured with so it can import the file.

I've been searching around and found out that one option could be using XAMPP's mysql.exe command line, which I already tried to, but since the import command requires a database to make the import, it makes it impossible.

Do you have any another idea or know how to make an import without the need to provide a database?

Regards and thanks in advance!

0

Depending on the tool and parameters used to create the .sql dump file of multiple databases, the file will normally have

CREATE DATABASE DBn...;

and

USE DBn;

statements that will allow your import to proceed without hiccups. For example, both the mysqldump command mysqldump command and phpMyAdmin's Export function for multiple database insert them.

Assuming you have exported with a sensible tool like those above, then you can import the database with a command line like this:

mysql -u username -p < dumpfile.sql

Your mysql username account needs to have appropriate privileges to, for example, create databases.

You can even run this command in a more familiar way by naming the startingDB database to use before running the commands in dumpfile.sql:

mysql -u username -p startingDB < dumpfile.sql

As the dumpfile will have a CREATE DATABASE and USE before any CREATE TABLE or INSERT statements, everything will work fine.

  • Thanks for the edit, mustaccio. I'm just getting my feet wet here, as my rep shows! Cheers. – Joe Murray Oct 21 '14 at 7:08
  • I'm having the following error while performing that command: "ERROR 1046 (3D000) at line 29: No database selected". – ShadowHunter Oct 22 '14 at 17:24
  • Open up the sql dumpfile in an editor (I like to use simple low level ones when working with massive files), and check if there are any USE db statements and CREATE DATABASE statements in it. Also, could you share more the tool / command you used to create it? – Joe Murray Oct 22 '14 at 23:53
  • I used phpMyAdmin to export all the databases. By the way, what do I have to do when I find 'USE' and 'CREATE DATABASE' statements? – ShadowHunter Oct 24 '14 at 20:52
  • It's good that those statements arr there - your dump sounds fine. I would put a USE db; statement before the troublesome line, maybe on line1, for some existing db. Also, could you post a pastebin link to a snippet of the start of the file past line29 to the fist USE db; statement? – Joe Murray Oct 25 '14 at 4:22

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.