简体   繁体   中英

Laravel application not connecting to MySQL in App in azure

I have created Web App + MySQL resource. Deployed laravel application from bitbucket and it is working good. Now I need to link the database. So I have imported my local DB through MySQL in App. But I'm stuck how to configure.

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

I'm getting the above error if I try to login.

Below is the .env file

APP_NAME=SMS
APP_ENV=local
APP_KEY=<App key>
APP_DEBUG=true
APP_URL=<Application URL>

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=49226
DB_DATABASE=localdb
DB_USERNAME=azure
DB_PASSWORD=<Password>

For APP_ENV replace localhost with 127.0.0.1 in .env file. This will solve the issue.

Ref: https://stackoverflow.com/a/39993447/4468757

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