An Azure managed MySQL database service for app development and deployment.
ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
Hello,
We have a dashboard running on Azure App Service, connected to an Azure MySQL database. Earlier today, we experienced a connection issue that was resolved after restarting the server. Below are the relevant PHP (Laravel) logs:
2026-03-26 22:27:26] production.ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. {"exception":"[object] (PDOException(code: 2002): SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. at C:\\home\\site\\wwwroot\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connectors\\Connector.php:70) [stacktrace] [2026-03-26 22:27:29] production.ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. (SQL: select * from `classes` where `join_code` = ios_first_run) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002):
We also observed a CPU spike on the SQL database around the same time (screenshot attached).
Any suggestions or advise on what might have caused this issue, and any steps we can take to prevent it in the future?