> For the complete documentation index, see [llms.txt](https://learnimportant.gitbook.io/learn-important/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnimportant.gitbook.io/learn-important/windows10/heroku/dump-sql-file-to-cleardb-in-heroku.md).

# Dump sql file to ClearDB in Heroku

https\://stackoverflow\.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685

## [Dump sql file to ClearDB in Heroku](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku)

[Ask Question](https://stackoverflow.com/questions/ask)Asked 7 years, 5 months agoActive [4 years, 4 months ago](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685?lastactivity)Viewed 12k times1516

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?[mysql](https://stackoverflow.com/questions/tagged/mysql) [ruby-on-rails](https://stackoverflow.com/questions/tagged/ruby-on-rails) [ruby](https://stackoverflow.com/questions/tagged/ruby) [heroku](https://stackoverflow.com/questions/tagged/heroku)[share](https://stackoverflow.com/q/11803496)[improve this question](https://stackoverflow.com/posts/11803496/edit)[edited Mar 3 '14 at 22:22](https://stackoverflow.com/posts/11803496/revisions)[![](https://www.gravatar.com/avatar/328293e03f2d7b888ecf197ec1ffb7a7?s=32\&d=identicon\&r=PG)](https://stackoverflow.com/users/634513/ismael-abreu)[Ismael Abreu](https://stackoverflow.com/users/634513/ismael-abreu)15.2k22 gold badges5353 silver badges7070 bronze badgesasked Aug 3 '12 at 21:24[![](https://www.gravatar.com/avatar/1f769ac40b6f5434f8eb211a358c4839?s=32\&d=identicon\&r=PG)](https://stackoverflow.com/users/1196150/hommer-smith)[Hommer Smith](https://stackoverflow.com/users/1196150/hommer-smith)20k4545 gold badges124124 silver badges228228 bronze badges

* 1When dumping in local you probably do `>` and not `<`, as the latter will actually restore and overwrite `mydatabasename`. – [Magne](https://stackoverflow.com/users/380607/magne) [Dec 10 '14 at 8:32](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#comment43238978_11803496)
* You don't "dump into", you "dump out of" a database. Then you "restore" a database from a dump. – [Magne](https://stackoverflow.com/users/380607/magne) [Dec 10 '14 at 8:34](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#comment43239025_11803496)

[add a comment](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#)

### 2 Answers

[active](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku?answertab=active#tab-top)[oldest](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku?answertab=oldest#tab-top)[votes](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku?answertab=votes#tab-top)33

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
```

[share](https://stackoverflow.com/a/11803685)[improve this answer](https://stackoverflow.com/posts/11803685/edit)[edited Sep 4 '13 at 10:46](https://stackoverflow.com/posts/11803685/revisions)answered Aug 3 '12 at 21:41[![](https://www.gravatar.com/avatar/328293e03f2d7b888ecf197ec1ffb7a7?s=32\&d=identicon\&r=PG)](https://stackoverflow.com/users/634513/ismael-abreu)[Ismael Abreu](https://stackoverflow.com/users/634513/ismael-abreu)15.2k22 gold badges5353 silver badges7070 bronze badges

* Thanks for that! I didn't use the command line, but it worked perfectly when I connected remotely with Sequel Pro. You're a lifesaver. – [Kyle Carlson](https://stackoverflow.com/users/1212550/kyle-carlson) [Feb 5 '14 at 8:51](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#comment32584750_11803685)
* 3use `heroku config` to get the CLEARDB\_DATABASE\_URL which contains the info you need for this command, in the format: `mysql://user:password@host/heroku_db?reconnect=true`. In this case: `mysql://b5xxxxx7:37d8faad@us-cdbr-east.cleardb.com/heroku_xxxxxx?reconnect=true` – [Magne](https://stackoverflow.com/users/380607/magne) [Dec 10 '14 at 10:50](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#comment43243637_11803685)&#x20;
* I tried following your comment but it gave me this error: `REFERENCES command denied to user 'baexxxxxxxxxxx'@'ec2-54-165-50-141.compute-1.amazonaws.com' for table 'ycdb.recipe'` Any ideas on how to solve this? – [thegreathypocrite](https://stackoverflow.com/users/7660753/thegreathypocrite) [Dec 23 '18 at 15:26](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#comment94654209_11803685)

[add a comment](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#)2

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.[share](https://stackoverflow.com/a/32490617)[improve this answer](https://stackoverflow.com/posts/32490617/edit)[edited Sep 9 '15 at 23:30](https://stackoverflow.com/posts/32490617/revisions)answered Sep 9 '15 at 23:19[![](https://lh6.googleusercontent.com/-IMKlJqackKg/AAAAAAAAAAI/AAAAAAAAAKs/LJLjJM2XFC0/photo.jpg?sz=32)](https://stackoverflow.com/users/4826188/hamid-hoseini)[Hamid Hoseini](https://stackoverflow.com/users/4826188/hamid-hoseini)1,0961111 silver badges1818 bronze badges[add a comment](https://stackoverflow.com/questions/11803496/dump-sql-file-to-cleardb-in-heroku/11803685#)

### Your Answer
