onoke
onoke

Reputation: 119

Heroku, data import error with mysql2

I am beginner on Heroku. I push my exist ruby on rails application into heroku and that was fine. Next i push my mysql data into heroku with 'push' command as following.

$heroku config:add DATABASE_URL='mysql2://<my CLEARDB_DATABASE_URL>@<myapp>.herokuapp.com/heroku_db?reconnect=true'
$heroku db:push mysql2://<my CLEARDB_DATABASE_URL>@<myapp>.herokuapp.com/<my dump file>

But i got error as following.

Failed to connect to database:
Sequel::DatabaseConnectionError -> Mysql2::Error: Can't connect to MySQL server on '<myapp>.herokuapp.com' (110)

I am confusing what should i do. Someone tell me how to resolve it.

Many thanks.

-Ono

Upvotes: 0

Views: 175

Answers (1)

catsby
catsby

Reputation: 11342

Don't use db:push or db:pull. Please export a sql file locally and either pipe it in like so:

$ heroku pg:psql DATABASE_URL -a app_name < file.sql

Or better, use Postgres locally and use pgbackups to import/export like so: Importing and Exporting Heroku Postgres Databases with PG Backups

Upvotes: 0

Related Questions