This is used in MySQL, because root permissions are too high, so create a new user appadmin, permissions only to use the database. The statement is created as follows: Grant Select,insert,update,delete on test.* to appadmin@ "%" identified by "password" where @ "%" is available at any address.
After it is created, it is viewed under Mysql.user and has that user. However, using the Mysql-u Appadmin-ppassword log on, you are prompted to not be able to log on: ERROR 1045 (28000): Access denied for user ' appadmin ' @ ' localhost ' (using PASSWO Rd:yes)
Baffled, then Google, and some people said that "Mysql.user table has some other records have a role, most likely is already have a ' @localhost record, is the user name is empty, host field is localhost record." "Affected. Look at the table indeed there is.
Mysql> select Host,user,password from Mysql.user;
+-----------+------------------+-------------------------------------------+
| Host | user | password |
+-----------+------------------+-------------------------------------------+
| localhost | Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |
| Mza | Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |
| 127.0.0.1 | Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b |
| localhost | | |
| Mza | | |
| localhost | Debian-sys-maint | *19df6bf8310d46d681ae072ab73ecec99c018c19 |
| % | Appadmin | *2470c0c06dee42fd1618bb99005adca2ec9d1e19 |
+-----------+------------------+-------------------------------------------+
7 Rows in Set (0.00 sec)
However, users who are empty (anonymous) are still unable to log on after they have been deleted. (Probably because it didn't restart MySQL) so I had to look at the MySQL reference manual with patience. Found that the added user section has this passage:
Two of these accounts have the same username Monty and password Some_pass. Two accounts are superuser accounts with full privileges to do anything. An account (' Monty ' @ ' localhost ') is used only when connecting from the local computer. Another account (' Monty ' @ '% ') can be used to connect from other hosts. Please note that the two accounts of Monty must be able to connect Monty from any host. Without a localhost account, the localhost anonymous user account created by mysql_install_db will be preempted when Monty is connected from the local computer. As a result, Monty will be treated as an anonymous user. The reason is that the host column value for the anonymous user account is more specific than the ' Monty ' @ '% ' account, which is listed first in the User table sort order.
This paragraph is clear, so executive Grant Select,insert,update,delete on test.* to appadmin@ "localhost" identified by "password";
After exiting with Appadmin login, successful.