Bug #10524 granting permssions to localhost crashes the server without running 'use mysql'
Submitted: 10 May 2005 19:24 Modified: 10 May 2005 19:36
Reporter: Waldemar Jankowski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3-beta-standard OS:Linux (linux)
Assigned to: CPU Architecture:Any

[10 May 2005 19:24] Waldemar Jankowski
Description:
This works well:

-----
grant ALL on foo.* to
foo identified by 'bar';
flush privileges;
------

but this crashes the server:
---------
grant ALL on foo.* to
foo@localhost identified by 'bar';
flush privileges;

ERROR 2013 (HY000): Lost connection to MySQL server during query
---------

A workaround is to make sure you always select the database first.
use mysql;
grant ALL on foo.* to
foo@localhost identified by 'bar';
flush privileges;

This is a minor inconvenience, but in the older versions of mysql you did not have to have
"use mysql" first and it autmatically new were to apply the perms.  This only happens if you try to grant perms to localhost, otherwise it works as expected. 

How to repeat:
Try to grant perms to localhost without specifying to "use mysql" first
[10 May 2005 19:36] MySQL Verification Team
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:

miguel@hegel:~/dbs/5.0$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.6-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant ALL on foo.* to
    -> foo@localhost identified by 'bar';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql>

Thank you for the bug report.