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?
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.
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With