Home > Blockchain >  Why does mysql client ask me for user to be introduced as <username@hostname>
Why does mysql client ask me for user to be introduced as <username@hostname>

Time:01-27

when I connect to a mysql database in the following way an error is printed asking me to introduce user as username@hostname: mysql -h <hostname> -u<user_name> -P 3306 -p<password>

Introducing it in that other way it works: mysql -h <hostname> -u<user_name>@<hostname> -P 3306 -p<password>

However, my workmates are able to connect to the database putting only the user, since you are indicating the host with option -h

Why? PD: mysql --version mysql Ver 14.14 Distrib 5.7.40, for Linux (x86_64) using EditLine wrapper

I attach error shown enter image description here

CodePudding user response:

The error 9002 is specific to Microsoft Azure, not plain MySQL.

https://learn.microsoft.com/en-us/azure/mysql/single-server/quickstart-create-mysql-server-database-using-azure-portal#connect-to-azure-database-for-mysql-server-using-mysql-command-line-client

For Azure Database for MySQL, you need to add @<servername> to the admin user name, as shown here:

mysql --host=mydemoserver.mysql.database.azure.com --user=myadmin@mydemoserver -p

I don't use Azure, and I don't know why they have this requirement. I suggest you ask their technical support.

  • Related