Dump sql file to ClearDB in Heroku

Viewed 15227

I have a sql file that I want to be dumped into a MySQL database that I have in Heroku using the ClearDB addon. When dumping in local I do the following:

mysql -u my_user -p mydatabasename < my_dump_file.sql

However, I don't have any clue on how to dump it to the Heroku MySQL database. All I know is this address:

mysql://b5xxxxx7:37xxxad@us-cdbr-east.cleardb.com/heroku_xxxxxx?reconnect=true

But if I try to do:

mysql://b5xxxxx7:37d8faad@us-cdbr-east.cleardb.com/heroku_xxxxxx?reconnect=true < my_dump_file.sql

I get No such file or directory.

How am I supposed to do it?

4 Answers

I was getting errors when I typed it all at once so I broke it down into small steps first I entered my MySQL details like so:

mysql --host=us-cdbr-iron-east-02.cleardb.net --user=xxxxxxxxxxxxxx --password=xxxxxxxx --reconnect 

then once I got in I changed to the database like so:

mysql> use heroku_xxxxxxxxxx;

then I now imported the SQL file like so:

mysql> source path/to/file.sql;

I try all the answers above, but none work.

Then I read this, and I conclude that I need to try it on CMD (previously I use Windows PowerShell admin).

No more errors in code.

I used this code (provided in the previous comment)

mysql -h us-xxxxxx.cleardb.com -u b7xxxxxxx -p heroku_df32xxxxxxx < dbname.sql
Related