One user to add
- Add a user by using the Insert method
Insert into Mysql.user (Host,user,password) VALUES ("localhost", "sa", Password ("admin123"))
An exception occurred:
Dbcexception:sql Error [1364] [HY000]: Field ' ssl_cipher ' doesn ' t has a default value
Java.sql.SQLException:SQLException:Field ' ssl_cipher ' doesn ' t have a default value
Exception reason : prohibit the user users from being modified by the insert method
Workaround: There is a statementin my.cnf : Sql_mode=no_engine_substitution,strict_trans_tables.
will be changed to: Sql_mode=no_engine_substitution.
Restart the server.
- Create by command
CREATE USER ' sa ' @ ' 127.0.0.1 ' identified by "admin123";
192.168.189.%:ip can restrict a user's IP by using wildcards
Two . User Delete
DELETE from user WHERE user= "sa" and host= "localhost";
Flush privileges;
Three . Change Password
Update Mysql.user set Password=password (' new password ') where
User= "sa" and host= "localhost";
Flush privileges;
Iv. . User Authorization
Create Database Cplusplusdb;
authorizes the cplusplus user to have All the permissions of the CPLUSPLUSDB database.
Grant all privileges the cplusplusdb.* to [email protected] identified
By ' admin123 ';
Refresh System Permissions Table
Mysql>flush privileges;
Five . Partial Authorization
Grant Select,update on cplusplusdb.* to [email protected]
Identified by ' admin123 ';
refreshes the System permissions table.
Flush privileges;
MySQL Account management