Description:
On page http://www.mysql.com/doc/en/Adding_users.html the introduction to a sample does not match the sample that follows.
The introduction states: "The following example adds a user custom who can connect from hosts localhost, server.domain, and whitehouse.gov."
The sample then has:
-> TO custom@localhost
-> TO custom@whitehouse.gov
-> TO custom@'%'
Following the example, we have an explanation:
"The reason that we issue two grant statements for the user 'custom' is that we want the give the user access..."
Three grant statements are issued, not two.
A more complete copy of the sections in question are included in the how to repeat section.
How to repeat:
The following example adds a user custom who can connect from hosts localhost, server.domain, and whitehouse.gov. He wants to access the bankaccount database only from localhost, the expenses database only from whitehouse.gov, and the customer database from all three hosts. He wants to use the password stupid from all three hosts.
To set up this user's privileges using GRANT statements, run these commands:
shell> mysql --user=root mysql
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON bankaccount.*
-> TO custom@localhost
-> IDENTIFIED BY 'stupid';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON expenses.*
-> TO custom@whitehouse.gov
-> IDENTIFIED BY 'stupid';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON customer.*
-> TO custom@'%'
-> IDENTIFIED BY 'stupid';
The reason that we issue two grant statements for the user 'custom' is that we want the give the user access to MySQL both from the local machine with Unix sockets and from the remote machine 'whitehouse.gov' over TCP/IP.
Suggested fix:
Change:
-> TO custom@'%'
To:
-> TO custom@'server.domain'