Shane
Shane

Reputation: 667

mysql command line connection to azure

I am using azure and mysql. I CAN connect to the azure mysql instance with the GUI mysql workbench however trying to connect with the command line always gives an access denied.

Here is my connection string (obfuscated)

mysql -h azureserver -u myuser -p thepass -D thedatabase

Here is the output from the command

$ mysql -h azureserver -u myuser -p thepass -D thedatabase 
Enter password: 
ERROR 1045 (28000): Access denied for user 'myuser'@'azureserver' (using password: NO)

Why can I connect with the GUI client and the command line client fails? I used the -p to specify a password but clearly the results implies that I am not using a password (see above)

Am I missing some detail when trying to connect through the command line to an Azure mysql instance?

The Azure tutorial implies that this is all I need PHP mysql azure tutorial

So to summarize:

  1. Yes the MySQL db is up and running. I can access it through my app AND I can access it through the GUI MySQLWorkbench
  2. Trying to access the db with the commandline tool fails indicating that I am not using a password when in fact I am with the -p switch.
  3. My dev box is running MacOSX

Upvotes: 2

Views: 7836

Answers (1)

Álvaro González
Álvaro González

Reputation: 146450

Key points:

  • -p thepass
  • using password: NO

As per the docs:

--password[=password], -p[password]

The password to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, mysql prompts for one.

So you're asked for a password, but you apparently didn't type anything at the Enter password: prompt. Thus the error.

Upvotes: 3

Related Questions