Bug #76969 mysql treats password argument (-p) inconsistently
Submitted: 7 May 2015 12:24 Modified: 17 Mar 2016 7:50
Reporter: Tahir Hassan Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.6 OS:Windows
Assigned to: CPU Architecture:Any

[7 May 2015 12:24] Tahir Hassan
Description:
mysql command line tool, found at path:

C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe

works inconsistently with the password argument.

How to repeat:
Installed community edition 

* mysql-installer-community-5.6.24.0.msi

and specified a root password of 4saR00t£r (this is the real password).

I then tried using the command line mysql tool:

mysql -uroot -p4saR00t£r

This logged in fine.

However, when I tried doing the more secure version:

mysql -uroot -p

and typed my password, it gave me the error:

Access denied for user 'root'@'localhost' (using password: YES)

Thereafter I logged in the first way (which worked) and executed the following statements:

update mysql.user set password=PASSWORD('4saR00t£r') where user='root';
flush privileges;

Thereafter, if I tried specifying the password on the commandline gave me an error message:

mysql -uroot -p4saR00t£r

gave me:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

but using 

mysql -uroot -p

(with the password typed in after being prompted) worked.

Lastly, I used mysqladmin to reset the password to something else, and finally it worked in both instances.

This can't be intended behaviour clearly.
[8 May 2015 5:57] Chiranjeevi Battula
Hello Tahir Hassan,

Thank you for the bug report.
I tried to reproduce the issue at my end using mysql-installer-community-5.6.24.0.msi in new system but not seeing any issues with password.

Thanks,
Chiranjeevi.
[8 May 2015 8:40] Tahir Hassan
Thanks Chiranjeevi for your response.

I reproduced this bug twice, at work and at home.

Could you try this on a new machine:

* Install mysql-installer-community-5.6.24.0.msi, setting the root password to 4saR00t£r
* login using the command line mysql tool:

mysql -uroot -p4saR00t£r

(At this point it should log in fine, so exit it).
* now log in trying:

mysql -uroot -p

It will ask you for the password which you will type but it will say:

Access denied for user 'root'@'localhost' (using password: YES)

------------------------------------

Can you confirm/disconfirm the above happening?  I am just surprised that I could get this same bug to reproduce at work and at home.  Is it the password I am using, because I was using the same one twice?
[17 Mar 2016 7:50] Chiranjeevi Battula
Hello Tahir Hassan,

Thank you for your feedback.
I could not repeat this issue at my end with the provided information. 
If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Thanks,
Chiranjeevi.