Doug Fir
Doug Fir

Reputation: 21204

Importing a database using SSH

apologies for how simple this question will be to followers of the SQl and SSH tags.

I would like to upload a copied database into a new database.

I created a copy of a data base I'd like to duplicate into my root folder. My root folder now contains a file "sitename_duplicate" with all the data.

In my web host control panel I created a new database "20130924_sitename"

I cannot seem to upload the contents of sitename_duplicate into 20130923_sitename.

mysql -u myname -p sitename_duplicate < 20130923_sitename.sql
-bash: 20130923_sitename.sql: No such file or directory

mysql -u myname -p 20130923_sitename < sitename_duplicate.sql
-bash: sitename_duplicate.sql: No such file or directory

The database with the data is sitename_duplicate and it's in the root. The blank and newly created database is 20130923_sitename.

How do I move the contents of sitename_duplicate into 20130923_sitename using SSH?

Upvotes: 2

Views: 1086

Answers (1)

herrjeh42
herrjeh42

Reputation: 2793

The syntax is

mysql -u username -pPassword --host hostname database_name < dump.sql

So it should be for you:

mysql -u myname -pMyPassword 20130924_sitename < sitename_duplicate

Upvotes: 2

Related Questions