Connection to Azure MySQL server fails due to incorrect connection string Connection to Azure MySQL server fails due to incorrect connection string azure azure

Connection to Azure MySQL server fails due to incorrect connection string


When connecting to your server instance of Azure Database for MySQL, you are required to follow the <username@hostname> format , whether you are doing it from mysqlexe client or MySQL workbench. We recommend you get the complete connection string for your client from the Azure portal and use it when connecting to your MySQL server.

Read How to get Connection Information to understand more about how to connect to your MySQL server from various clients.


I have the same issue and it appears that this is related to the MySQL Shell. Not the classic mysql.exe command line tool. I try to connect to my MySQL Azure database from within the MySQL Shell as follows:

mysql-sql> \sqlmysql-sql> \connect -c myuser@myserver.mysql.database.azure.comCreating a Classic Session to 'myuser@myserver.mysql.database.azure.com'Enter password: *********ERROR: 2001 (28000): The connection string may not be right. Please visit portal for references.mysql-sql>

According to the Azure docs (as referenced above) one should give the username as "username@servername" but there is no way to specify this using the MySQL Shell.

Has anyone succeeded in connecting to an Azure MySQL db via the MySQL Shell?

I can add that I have tested the same connection info with the classic mysql.exe and the following works fine:

mysql.exe -u myuser@myserver -h myserver.mysql.database.azure.com -p

My guess is that the real issue is that the MySQL Shell cannot accept an at sign (@) in the username.


It's working for me use username@hostname in the username section.