Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dump sql file to ClearDB in Heroku

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:[email protected]/heroku_xxxxxx?reconnect=true

But if I try to do:

mysql://b5xxxxx7:[email protected]/heroku_xxxxxx?reconnect=true < my_dump_file.sql

I get No such file or directory.

How am I supposed to do it?

like image 478
Hommer Smith Avatar asked Aug 03 '12 21:08

Hommer Smith


People also ask

How do I create a ClearDB database?

Once in the ClearDB portal, simply click on the Databases tab, then click 'New Database'. Select a name, character set, sort collation, and finally a username and password for the database, then click 'Create Database'. Use this information to build your new DATABASE_URL.

How do I connect to heroku ClearDB?

In heroku website, go to My Apps and select the app on which you have installed ClearDB. On the top corner click on Addons and then select ClearDB MySQL Database. Once there, click on your database and choose the 'Endpoint Information' tab. There you see your username/password.

Is ClearDB free on heroku?

Heroku customers can get started using ClearDB on Heroku for free with our 5MB Ignite package, and move into production use with our Punch package, a great price at $9.99 per month with 1GB of storage.

Is MySQL a ClearDB?

ClearDB is a cloud, hybrid, and on-premise database-as-a-service for MySQL powered applications. It stores and manages your MySQL database for you so that you don't have to deal with things like database servers, replication, advanced storage, IT support, and especially things like database failures.


2 Answers

You might be able to do something like this

mysql --host=us-cdbr-east.cleardb.com --user=b5xxxxx7 --password=37d8faad --reconnect heroku_xxxxxx < my_dump_file.sql
like image 116
Ismael Avatar answered Oct 05 '22 23:10

Ismael


It doesn't work for me on the new version of mysql. So I tried following code:

mysql -h us-cdbr-east.cleardb.com -u b5xxxxx7 -p heroku_xxxxxx < my_dump_file.sql 

and then it asks your password.

like image 25
Hamid Hoseini Avatar answered Oct 06 '22 00:10

Hamid Hoseini