简体   繁体   English

无法在Heroku上迁移数据库(尝试过MySQL和PostgreSQL)

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

I am trying to run Laravel app on Heroku 我正在尝试在Heroku上运行Laravel应用

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. 但是,当我尝试通过使用命令heroku运行php artisan serve迁移数据库时,出现以下错误。

In Connection.php line 664: 在Connection.php行664中:

SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_s chema.tables where table_schema = forge and table_name = migrations) SQLSTATE [HY000] [2002]连接被拒绝(SQL:从information_s chema.tables中选择*,其中table_schema = forge,table_name = migrations)

In Connector.php line 68: 在Connector.php第68行中:

SQLSTATE[HY000] [2002] Connection refused SQLSTATE [HY000] [2002]连接被拒绝

I've made changes in .env file too for DB credentials and host. 我也对数据库凭证和主机在.env文件中进行了更改。

You need to set the environment variables in Heroku's web admin panel 您需要在Heroku的网络管理面板中设置环境变量

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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