2

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

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

LOL... I knew it was something trivial like that. It is interesting that the other options can deal with a space but the password short form can't. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.