Hello Nkugwa Mark William
This error indicates that the client established a TCP connection to the server, but the connection was lost during the initial handshake phase. Even if you've configured the firewall to allow all IPs, other factors might be contributing to this issue.
The connection was established, but it was lost afterwards. This can happen if a connection is attempted against something that isn't MySQL (like using a MySQL client to connect to SSH on port 22 for example). It can also happen if the super user kills the session. It can also happen if the database times out the session. Or it can refer to issues in the database server, after the connection is established. This can happen at any time during the lifetime of the client connection. It can indicate that the database had a serious issue.
https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-troubleshoot-connectivity-issues
To solve the issue try:
- Public Access & Networking Mode
- Ensure your server is using public access (allowed IPs) or private access (via VNet) depending on your use case. Go to Azure Portal > Your MySQL Flexible Server > Networking If Private access is selected, ensure your client is inside the same VNet/subnet. If Public access, ensure your IP (or 0.0.0.0 - 255.255.255.255 for open) is allowed.
- SSL Configuration
- Azure MySQL Flexible Server enforces SSL by default. If you're using a command like: mysql -h <server-name>.mysql.database.azure.com -u <username>@<server-name> -p Then either Use the --ssl-mode=REQUIRED flag, or disable SSL in server settings only for testing purposes (not recommended in production). mysql --ssl-mode=REQUIRED -h <server>.mysql.database.azure.com -u <user>@<server> -p
- Server Logs
- Check the Server Logs in Azure Portal. Go to Azure > MySQL Flexible Server > Server Logs Look for entries that correspond to failed connection attempts — particularly anything mentioning handshake, SSL negotiation, or dropped packets.