#0 Change the root password
Mysqladmin-u root-p Password yeqing
#1 Delete Unused accounts
Select User,hostfrom mysql.user;
Delete from Mysql.user where user! = ' root ';
Delete from mysql.user where user = ' root ' and host= ' 127.0.0.1 ';
Flush privileges;
#2 Delete root account by mistake?
/etc/init.d/mysqld Stop or Pkill mysqld
Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
Mysql
UPDATE mysql.user SET password=password (' yeqing '), host= ' localhost ' where user= ' root ';
Flush privileges;
Pkill mysqld
Pkill mysqld
Mysql-u root-p
Yeqing Enter
#3 first create account re-authorization (method one)
Create [email protected] ' localhost ' identified by ' 123456 ';
Grant all ondb1.* to [email protected] ' localhost ';
Or
Grant Select,insert,update,delete, create,dropon db1.* to ' yeqing ' @ ' 192.168.1.% ' identified by ' test123 '
Flushprivileges;
Show grants [email protected] ' localhost ';
#4 simultaneous authorization to create an account (method two)
Grant all onmysql.* to [email protected] ' localhost ' identified by ' 123456 ';
Grant all on * * to [e-mail protected] ' 192.168.1.% ' identified by ' test123 '
Flushprivileges;
MySQL Account and Rights management