1. Add a user (in two forms):
A.mysql> Grant All on * * to [e-mail protected] "%" identified by "123";
Mysql>flush privileges; (Refresh System Permissions table)
(After execution will insert a record in the Mysql.user table, all means all permissions (including add and delete changes and other permissions), * * For all databases, Yushan for the added user name, 123 for the password,% for all hosts matching, the above information can be specified such as Grant Select, Update on db.* to [e-mail protected] identified by ' 123 ';)
B. Add a record directly to Mysql.user
mysql> INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost", "Yusuhan", Password ("123"));
Mysql>flush privileges;
This creates a user named: Yushan password: 123 (password is encrypted), but does not have permissions because only three fields are added, and permissions can be added through grant:
Mysql>grant all on * * to [e-mail protected] identified by ' 123 ";
Mysql>flush privileges; (Refresh system Permissions table)
Add user if you want to log in to MySQL remotely, you must follow the host IP as follows:
[Email protected] ~]# mysql-u yushan-p-H 192.168.59.123
Enter Password: (enter password)
2. Delete the User:
Mysql>delete from mysql.user where user = ' Yushan ';
Mysql>flush privileges; (Refresh System Permissions table)
MySQL Create, delete user