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

Author Topic: What's the best way to import a large mysql database ?  (Read 3751 times)

Offline megamanTopic starter

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 1
  • Posts: 32
  • Karma: 1
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



Offline cookiemonster

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 2
  • Posts: 33
  • Karma: 2
  • More Cookies !!!
Re: What's the best way to import a large mysql database ?
« Reply #1 on: 05-10-2010, 03:08:36 »
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 :)

Offline sam

  • Trade Count: (0)
  • Semi-Newbie
  • *
  • Thank You 1
  • Posts: 20
  • Karma: 3
  • Gender: Male
    • anyquestion.webvertex.co.in
What's the best way to import a large mysql database ?
« Reply #2 on: 02-08-2012, 21:30:14 »
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
anyquestion.webvertex.co.in

Offline allricjohnson

  • Trade Count: (0)
  • Jr. Member
  • **
  • Thank You 15
  • Posts: 50
  • Karma: 0
Re: What's the best way to import a large mysql database ?
« Reply #3 on: 04-05-2012, 03:57:37 »
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

Then..

mysql> SOURCE /home/user/database.sql

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

Have Fun !
River Delta India is an USA and India based Internet Marketing Services providing Company.

Offline Lechlak

  • Trade Count: (0)
  • Jr. Member
  • **
  • Thank You 2
  • Posts: 50
  • Karma: 2
    • Lechlak Web Design
Re: What's the best way to import a large mysql database ?
« Reply #4 on: 05-14-2012, 07:06:42 »
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.


 

Related Topics

  Subject / Started by Replies Last post
1 Replies
1270 Views
Last post 04-03-2012, 01:29:27
by JessicaJohn
4 Replies
3125 Views
Last post 07-16-2012, 07:07:34
by sunilkumar
1 Replies
2742 Views
Last post 07-17-2012, 00:22:23
by thelazytrader
7 Replies
2787 Views
Last post 09-07-2016, 02:54:25
by TomClarke
0 Replies
956 Views
Last post 12-23-2015, 04:45:59
by chinmay.sahoo