PDA

View Full Version : Importing MySQL Via SSH



kevster
12-30-2009, 06:04 AM
Hi everyone,

I have a 230MB file to import. I have logged in on my old server under as da_admin and extracted the databases i need.

I was going to import them into the new server however its going to take too long via uploading it on the webpage.

Is there a quicker way I can do it via SSH?

When i exported the da_admin file it comes out as localhost.

THanks,
Kevin.

woonap
12-30-2009, 06:21 AM
Hi,

yeah, the better way for big SQL files is to import via SSH command.

1.) Upload the SQL file via FTP Software on your webspace in for example your public_html folder (but do not forget to delete the SQL file (test.sql) after importing)

2.) Open SSH client and login as root

3.) Run the following command (don't forget to change the path and user and database information):

mysql -u databaseuser -p databasename < /home/username/public_html/test.sql

You will get:
"Enter password:" Enter database password.

Maybe it will take a while to import the 200 MB database (depends on server configuration).

Good luck!

Cheers
Michael

thanhtamntp
12-30-2009, 07:07 PM
you can use bigdump
http://www.ozerov.de/bigdump.php

kevster
12-30-2009, 07:38 PM
Hi thanhtamntp,

Thanks for that :) I used Michael's solution however next time I will test that.

Thanks,
Kevin.

RosenCruz
04-09-2010, 04:46 PM
Hi,

yeah, the better way for big SQL files is to import via SSH command.

1.) Upload the SQL file via FTP Software on your webspace in for example your public_html folder (but do not forget to delete the SQL file (test.sql) after importing)

2.) Open SSH client and login as root

3.) Run the following command (don't forget to change the path and user and database information):

mysql -u databaseuser -p databasename < /home/username/public_html/test.sql

You will get:
"Enter password:" Enter database password.

Maybe it will take a while to import the 200 MB database (depends on server configuration).

Good luck!

Cheers
Michael

I m following this steps and they all work good , but after "enter password" step, my keyboard freezez and I can not type,any possible reasons for this ?

floyd
04-10-2010, 04:06 AM
but after "enter password" step, my keyboard freezez and I can not type

Did you use another computer to post this?

RosenCruz
04-10-2010, 05:37 AM
Did you use another computer to post this?

It happens on SSH client

floyd
04-10-2010, 12:38 PM
So your keyboard does not actually freeze. Your server may get overloaded trying to import the large sql file and therefore cannot accept input from the keyboard.

SeLLeRoNe
04-14-2010, 09:01 AM
well if you can write the command line without problem you should put all data in 1 line like this:


mysql -uUSERNAME -pPASSWORD DBNAME < FILE.SQL

regards