Bug #19652 Wrong description on how to create new user accounts
Submitted: 9 May 2006 20:55 Modified: 10 May 2006 13:32
Reporter: Thomas Schweikle Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:3.x,4.x OS:Any (All)
Assigned to: CPU Architecture:Any

[9 May 2006 20:55] Thomas Schweikle
You are sure any of these commands describet work? I am not:
mysql> grant all privileges on *.* to 'ts'@'%' identified by 'password' with grant option;
Query OK, 0 rows affected (0.00 sec)

No error, but no row affected?
INSERT shows a little bit more:
mysql> insert into user values('%','ts',PASSWORD('password'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
ERROR 1136 (21S01): Column count doesn't match value count at row 1

Looks like the description in the MySQL Handbook for version 4.1, chapter 5.8.3 on adding users is quite wrong!

How to repeat:
Install MySQL (emerge mysql, apt-get install mysql, portinstall mysql, or with windows: fetch the installer). Configure my.cnf, then start mysqld. connect with "mysql -u root mysql", then the above commands.

Suggested fix:
Fix the documentation on how to create user accounts. The way described isn't the way it is working!
[9 May 2006 22:17] Hartmut Holzgraefe
The GRANT command works just fine, the fact that it returns "0 rows affected" does not indicate an error. CREATE TABLE for example also returns "0 rows affected". 

Creating a user using "INSERT INTO user ..." is not recommended anymore, use the GRANT command instead. The number of columns in the mysql.user table can change between major
releases, so the error message you get is due to the fact that you picked an example for a different server version than the one you are using.

Just try to log in as the user you created with grant to see that it *is* actually working.
[10 May 2006 13:32] Thomas Schweikle
Yes it is now working, but I had to deactivate the anonymous user for localhost, by adding a username and password. After this change I could add new users.