Bug #14359 Unexpected behavior of multiple commands with mysqladmin
Submitted: 26 Oct 2005 21:31 Modified: 22 Nov 2005 17:48
Reporter: [ name withheld ] Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:MySQL 4.1.12 OS:MacOS (Mac OS X Server 10.4.2)
Assigned to: CPU Architecture:Any

[26 Oct 2005 21:31] [ name withheld ]
Description:
This sets a password on the localhost root user as expected:

mysqladmin -u root flush-privileges
mysqladmin -u root password pw2

But trying to do the same with a single command leaves the localhost root password *empty* and instead sets a password on the *anonymous* localhost user:

mysqladmin -u root flush-privileges password pw2

How to repeat:
Case 1.

As root, from a new database established with mysql_install_db:

mysql_safe --skip-grant-tables &

mysqladmin -u root flush-privileges
mysqladmin -u root password pw2

mysql -ppw2 -e "SELECT Host, User, password FROM mysql.user;"

+-------------------+------+-------------------------------------------+
| Host              | User | password                                  |
+-------------------+------+-------------------------------------------+
| localhost         | root | *B27918D2D9402882CEADA0EF687D35FBDC137D72 |
| vh1.example.com | root |                                           |
| vh1.example.com |      |                                           |
| localhost         |      |                                           |
+-------------------+------+-------------------------------------------+

mysqladmin -ppw2  shutdown

Case 2.

As root, from a new database established with mysql_install_db:

mysql_safe --skip-grant-tables &

mysqladmin -u root flush-privileges password pw2

mysql -e "SELECT Host, User, password FROM mysql.user;"

+-------------------+------+-------------------------------------------+
| Host              | User | password                                  |
+-------------------+------+-------------------------------------------+
| localhost         | root |                                           |
| vh1.example.com | root |                                           |
| vh1.example.com |      |                                           |
| localhost         |      | *B27918D2D9402882CEADA0EF687D35FBDC137D72 |
+-------------------+------+-------------------------------------------+

mysqladmin  shutdown
[26 Oct 2005 21:42] Jorge del Conde
Thanks for your bug report.  I was able to reporduce this using 10.4
[22 Nov 2005 17:47] Jorge del Conde
I was unable to reproduce this bug w/5.0.15:

jorge-~> mysql -uroot -e "SELECT Host, User, password FROM mysql.user;"
+-------------------------------------+------+----------+
| Host                                | User | password |
+-------------------------------------+------+----------+
| localhost                           | root |          |
| jorge-del-condes-power-mac-g4.local | root |          |
| jorge-del-condes-power-mac-g4.local |      |          |
| localhost                           |      |          |
+-------------------------------------+------+----------+
jorge-~>
[22 Nov 2005 17:48] Jorge del Conde
I couldn't reproduce it with the latest pull from our 4.1 tree