Large database file import help


#1

How do I go about importing a 50 mb sql dump file into mysql? I’ve tried several different scripts but still have not had any sucess.


#2

You’re not going to be able to do that with a CGI script (eg PHPMyAdmin, etc) because the process will be killed for taking too long.

Try it from a shell. See http://dev.mysql.com/doc/refman/5.1/en/batch-mode.html

Customer since 2000 :cool: openvein.org


#3

I was told to try to ssh it using this command:

$ mysql -h [hostname] -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]

When I try to connect via Terminal (on a mac), the server is kicking me back off with the message that I can only ftp. Is there a setting to allow an ssh connection?


#4

Yes. Login to the DreamHost Web Panel and go to Users -> Manager Users.

Customer since 2000 :cool: openvein.org


#5

Well I’m still stumped. I have made progress though. I am able to ssh into the shell, but when I enter the above command (with my password, etc, and the sql file is called dump.sql), I am getting the following error:

-bash: [dump.sql]: No such file or directory

I have chmoded the permissions to 777 and I am in the same directory as the dump.sql file when I am running the command. Still get the no such file message. Any ideas what I am doing wrong?

Can anyone confirm the syntax of the command, asumming I am running it from the same directory containing backupfile.sql:
$ mysql -h [mysql.mydomainname.com] -u [dbaseusername] -p[dbpassword] [db_to_restore] < [backupfile.sql]


#6

[quote]ell I’m still stumped. I have made progress though. I am able to ssh into the shell, but when I enter the above command (with my password, etc, and the sql file is called dump.sql), I am getting the following error:

-bash: [dump.sql]: No such file or directory[/quote]
Here’s a tip. Bash has an auto-completion where it if you start typing in a string and then hit TAB it will scan the filesystem and try to complete the string.

$ mysql -h [mysql.mydomainname.com] -u [dbaseusername] -p[dbpassword] [db_to_restore] < d

then hit the TAB key and Bash will try to find a file in the current directory starting with the letter d. Obviously if there is more than one it won’t do anything. But if you hit TAB again it will show a list of files starting with the letter d. If you know there is more than one that starts with d, you can type du before hitting TAB.

Customer since 2000 :cool: openvein.org


#7

I finally got it to work. Besides having syntax issues, I also had some extra lines in the dump file that the text editor added . The tab trick is good to know. Thanks for all your help.