Reputation: 53
I have uploaded my Laravel project to Heroku and I want to use my own database. It is hosted on a VPS. I have been using that DB from my computer and it worked fine but when I deploy my app it throws a Connection time out error.
I have used the following command to set up the connection:
heroku config:add DATABASE_URL=mysql://user:pass@server:port/database_name
Any idea on how can I achieve this? Or what am I doing wrong?
Thanks!!!!
Upvotes: 1
Views: 476
Reputation: 3032
Laravel doesn't know by default how to use the DATABASE_URL
environment variable you are setting.
I think you should probably run these commands
heroku config:add DB_HOST=server
heroku config:add DB_PORT=port
heroku config:add DB_USERNAME=user
heroku config:add DB_PASSWORD=pass
heroku config:add DB_DATABASE=database_name
Of course, change the values accordingly with your server configuration.
Upvotes: 1