Bug #3160 "mysqladmin password" doesn't work if --skip-grant-tables
Submitted: 12 Mar 2004 14:06 Modified: 16 Mar 2004 7:06
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Victor Vagin CPU Architecture:Any

[12 Mar 2004 14:06] Sergei Golubchik
Description:
mysqladmin password fails to change password if a server is started with --skip-grant-tables

How to repeat:
% mysqld --skip-grant-tables
% mysqladmin -u root password 'mynewpassword'
mysqladmin: unable to change password; error: 'You must have privileges to update tables in the mysql database to be able to change passwords for others'

Suggested fix:
after issuing SET PASSWORD=... mysqladmin should check error code returned.
If it's 1290 (ER_OPTION_PREVENTS_STATEMENT) - in 4.1 tree, that is (as this cannot be fixed in an earlier version) - mysqladmin should try to set the password with UPDATE mysql.user SET ...
[12 Mar 2004 15:20] Paul DuBois
A workaround is to use flush-privileges before password
to re-enable the grant tables.  From the manual:

@item
Set a new password for the @code{root@@localhost} MySQL user:
@example
shell> mysqladmin -u root flush-privileges password "newpwd"
@end example
Replace ``newpwd'' with the actual @code{root} password that you want
to use.

That doesn't make a bug not a bug, but the problem isn't
insurmountable. :-)
[15 Mar 2004 3:18] Victor Vagin
bk commit - 4.1 tree (vva:1.1783)

ChangeSet
  1.1783 04/03/15 19:04:24 vva@eagle.mysql.r18.ru +5 -0
  fixed bug #3160 '"mysqladmin password" doesn't work if --skip-grant-tables'
[15 Mar 2004 13:54] Michael Widenius
Approved, but without test case (see email)
[16 Mar 2004 3:50] Victor Vagin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

The fix will be in mysql-4.1.2
[16 Mar 2004 7:06] Victor Vagin
now mysqladmin simply prints an error message with an advice to use 

mysqladmin flush-privileges password 'newpassword'