Using Putty to Upload SQL Database


#1

After attempting to upload my SQL database via phpmyadmin and realizing it was too large I decided to use PuTTy instead. I connected to pincushion with my dreamhost account but have had issues. I am a bit confused about the final part of the command line used to import SQL databases. This is the line that I am using:

That part that I am confused about is the dump.sql part. Everything I enter into that returns: " -bash location I entered No such file or directory"

Where should I place the .sql file? Should I have it in a local folder or on my web directory and how do I direct to it?

Note: I am on shared hosting.

Thanks,
Josh


#2

Use FTP/SFTP to upload your dump file. You can just temporarily put it in your home directory.

In your command the < is a redirect character, in this case taking the contents of the file dump.sql and using it as input for the mysql command before it. In this case, it’s assumned that dump.sql is in the same directory that we are executing the command from, but it also could include a path such as…

mysql --host=mysql.mydomain.org--user=MyUsername --password=MyPass DatabaseName < .path/to/dump.sql

AND if your file is named websiteBackup140306.sql or something like that, then just chance dump.sql to websiteBackup140306.sql


#3

I’ve put that dump on my web root(mydomain.org) and tried

mysql --host=mysql.mydomain.org–user=MyUsername --password=MyPass DatabaseName < dump.sql

That didn’t work. I tried mydomain.org/dump.sql/ and that didn’t work. What am I doing wrong?


#4

I didn’t try, but if you entered mydomain.org/dump.sql/ you entered the name of a directory (it ends in /).

if the file is in mydomain.org/ then log in via putty and

$ cd mydomain.org

then run the command with < dump.sql on the end.


#5

That did the trick, thanks!