简体   繁体   中英

Unable to Migrate Database (tried MySQL and PostgreSQL) on Heroku

I am trying to run Laravel app on Heroku

I've pushed the app and configured it. But when I am trying to migrate database via using command heroku run php artisan serve it is giving following error.

In Connection.php line 664:

SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_s chema.tables where table_schema = forge and table_name = migrations)

In Connector.php line 68:

SQLSTATE[HY000] [2002] Connection refused

I've made changes in .env file too for DB credentials and host.

You need to set the environment variables in Heroku's web admin panel

Go to your app in Heroku -> settings -> Reveal Config Vars

Then set your environment variable Take for example

DB_DATABASE = your-database-name 
DB_HOST = your-database-host-name
DB_PASSWORD = your-db-password
DB_PORT = your-db-port
DB_USERNAME = your-db-username

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM