MySQL creates a new user:
CREATE USER username identified by ' password ';
Assign all permissions to the new user:
GRANT all privileges on * * to ' username ' @ ' localhost ' identified by ' password ';
To modify a user's permissions, first cut back to the root user and then use the following command (revoke the permissions of the new user and re-authorize):
Evoke all privileges on * * from ' username ' @ ' localhost '; GRANT all privileges the databasename.* to ' username ' @ ' localhost ' identified by ' password ';
You can also add only partial permissions to the user.
eg
To assign users only the Select and update permissions:
GRANT SELECT, UPDATE on databasename.* to ' username ' @ ' localhost ' identified by ' password ';
You need to refresh after assigning permissions:
FLUSH privileges;
To delete a user:
@>mysql-u root-p @> password mysql>delete from user Where user= ' username ' and host= ' localhost '; Mysql>flush privileges; Mysql>drop database databasename; Delete User's database Delete account and permissions: >drop user [email protected] '% '; >drop user [email protected];
change user password:
@>mysql-u root-p@> password mysql>update mysql.user set Password=password (' New password ') where user= "username" and host= " localhost "; mysql>flush privileges;
MySQL user management and Rights management