Importing MySQL Via SSH

Status
Not open for further replies.

kevster

Verified User
Joined
Jun 26, 2008
Messages
96
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.
 
Good idea - via SSH ;)

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
 
Hi thanhtamntp,

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

Thanks,
Kevin.
 
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 ?
 
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.
 
well if you can write the command line without problem you should put all data in 1 line like this:

Code:
mysql -uUSERNAME -pPASSWORD DBNAME < FILE.SQL

regards
 
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

Very nice answer Michael. Thank you.
 
Status
Not open for further replies.
Back
Top