Web Administration > Databases

What's the best way to import a large mysql database ?

(1/2) > >>

Hey guys,

I'm on linux and I have a 500+MB database. It seems to time out when using PHPMyAdmin, so what's my options and what are the alternatives when uploading my database and other such large .sql files....  :o

If you're on a dedicated box and have SSH access use this command:

mysql -u USERNAME -p DATABASE_NAME < yourdumpfile.sql

It's super quick :)

Use command prompt for large database import

mysql -u [database_username] -q [database_password] [databsae_name] < yourmysqldump.sql

if your database with no password

mysql -u [database_username] -q  [databsae_name] < yourmysqldump.sql

if you want export database

mysql -u [database_username] -q  [databsae_name] > exportfilename.sql

Sometimes importing large databases can get messy – tuning PHP and MySQL to get it right or using tools such as BigDump, these tools can be handy of course for specific environments but if you have SSH access the easiest way is to use SOURCE at the command line and your good to go.. to use it you just do the following:

mysql> use your_database


mysql> SOURCE /home/user/database.sql

Let it roll and once thats done your good to go..

Have Fun !

Command line is definitely the most efficient method. When I've used the actual interface like phpmMyAdmin it takes significantly longer because you are uploading the file and there are layers of user friendly features it sifts through.


[0] Message Index

[#] Next page

Go to full version