@Zeyad Naguib I don't think the issue is with access restrictions of your app service. I would recommend first reviewing Azure App Service virtual network integration troubleshooting guide - Azure | Microsoft Learn and using tcpping
to hit your MySQL database server. If you're not getting any response, configure service endpoints on the VNet. If no errors there, it may be an issue with the SSL in which you can download it again. You can also step through Connect using mysql command-line client with TLS/SSL to verify the connection.
Cannot access MySQL from Laravel Web App

Hello, I have a PHP 8.1 Laravel project setup with MySQL, I have followed exactly all the steps in this tutorial: https://learn.microsoft.com/en-us/azure/mysql/flexible-server/tutorial-php-database-app but instead of the sample project they gave, I use my own project on GitHub which works locally, up until the step that they require to do "php artisan migrate --force", it doesn't work, it gives me an SQLSTATE[HY000] [2002] Connection refused, I haven't changed anything or did anything outside of the steps, I'm not sure what's the issue. GitHub integrated successfully and deployment is successful, my configuration variables are setup correctly, and I can access the website using the domain (doesn't work yet because haven't finished up setting it but it sends me to the web app explorer page where I can view env, logs, requests, etc). I'm trying "php artisan migrate --force" on the Web App SSH in /home/site/wwwroot
- I have tried to add MYSQL_ATTR_SSL_KEY and VERIFY_SERVER_CERT to my config/database.php but still did not work.
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
PDO::MYSQL_ATTR_SSL_KEY => '/ssl/DigiCertGlobalRootCA.crt.pem',
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false
]) : [],
Azure Database for MySQL
Azure App Service
1 answer
Sort by: Most helpful
-
Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
2023-07-07T15:53:00.61+00:00