As indicated by Ryan above, you need a team
GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password';
However, note that the documentation indicates that for this you need to create another user account from localhost for the same user; otherwise, an anonymous account created automatically with mysql_install_db takes precedence because it has a more specific host column.
In other words; so that user user can connect from any server; 2 accounts must be created as follows:
GRANT ALL ON *.* to user@localhost IDENTIFIED BY 'password'; GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password';
Read the full documentation here.
And here is the corresponding snippet for reference:
After connecting to the server with administrator rights, you can add new accounts. The following statements use GRANT to create four new accounts:
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' -> WITH GRANT OPTION; mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' -> WITH GRANT OPTION; mysql> CREATE USER 'admin'@'localhost'; mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost'; mysql> CREATE USER 'dummy'@'localhost';
The accounts created by these operators have the following Properties:
Two accounts have a monty username and some_pass password. Both accounts are superusers with full privileges to do anything. The "monty" @localhost account can only be used when connecting to the local host. The account 'monty' @ '%' uses the '%' wildcard for the main part, so it can be used to connect from any host.
Both accounts for monty must be able to connect from anywhere as monty . Without a localhost account, the anonymous account for localhost created by mysql_install_db will take precedence when monty connects to the local host. As a result, monty will be treated as an anonymous user. The reason for this is that the anonymous user account has more specific host column value than the "monty" @ '%' account and thus earlier in the sort order of the user table. (Sorting the user table in section 6.2.4 "Access control, step 1: connection verification".)
It seems silly to me if I do not understand this.
Icarus Apr 19 '12 at 20:27 2012-04-19 20:27
source share