Reputation: 4161
I have setup a working heroku account with all my files and a database here - https://frozen-dusk-2587.herokuapp.com/
I downloaded the .sql file from my production server ( structure only | not actual data ) and want to upload it to Heroku.
How do I do this? I found this article here - How do I push my mysql database from phpmyadmin to heroku's cleardb?
Is this the correct way to do it?
It mentions this command in general which looks like a simple one liner
mysql <dbname> -u <username> -p<password> < <file.sql>
Is it this simple? If so where do I get the dbname, username, and password?
Clicking around Heroku I found this. It looks like my dbname
is
heroku_blahblah
If this is correct what do I use for username / password?
Upvotes: 3
Views: 3606
Reputation: 164
I created a MySQL add-on that lets you use MySQL on Heroku for free. You can indeed use a one-line command to upload your file (as long as you have mysql installed in the location you are issuing the command from).
To create a mysql database from the heroku toolbelt, try the following:
heroku addons:create jawsdb:NAME_OF_PLAN_HERE --app HEROKU_APP_NAME_HERE
Plans are detailed here
From there you will get a connection string of the form mysql://username:password@hostname:port/database_schema
set as a configuration variable in your heroku dashboard. Grab the credentials from there to load your .sql file.
Upvotes: 2
Reputation: 1344
As far as I know Heroku doesn't support mysql databases but it does support PostgreSQL. You can basically create a Postgres DB on https://postgres.heroku.com and migrate your mySQL database using one of the available tools. The connection details to your new DB will be accessible from your dashboard.
Upvotes: 0