I have a PHP Heroku app running, which uses a ClearDB MySQL database. I need to make backups of the database. I've been searching how to do it but I can't find it. Thanks.
Asked
Active
Viewed 1,559 times
2
-
2`mysqldump` works fine on a remote host. You can get the credentials from `heroku config`. – ceejayoz Sep 03 '18 at 16:26
-
This can help: https://stackoverflow.com/questions/9822313/remote-connect-to-cleardb-heroku-database – juzraai Sep 03 '18 at 16:29
-
1@ceejayoz And how can I run mysqldump on the server? I've tried `heroku run mysqldump` but it says `command not found`. – iporto Sep 07 '18 at 14:49
-
1You'd run it on your local computer, with the [`--host` parameter](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#option_mysqldump_host) to work with the remote connection. Use `heroku config` to look up the host, username, password, etc. – ceejayoz Sep 07 '18 at 14:55
-
Ah, I understand. It makes sense. Thank you!! – iporto Sep 08 '18 at 07:23
1 Answers
0
As suggested, you can do:
mysqldump -u<username> <DATABASENAME> --host=<host-url> -p > <afilename>
It will look something like
mysqldump -ub13cXXXXX heroku_6a343XXXXX --host=eu-cdbr-west-03.cleardb.net -p > mydbdump.sql
And it will ask your password.

nobot
- 63
- 1
- 7