A little security policy after MySQL installation is to remove empty users and host users who are not localhost
1. Delete Empty users
Remove Empty users
Mysql> Select Mysql.user,host,password from user whereuser= "; Query users
mysql> Delete from user where user= '; #删除user = Empty User
Delete Host Not equal to localhost of users
Mysql> Select User,host,password from user where host!= ' localhost ';
Mysql>delete from user where host!= ' localhost ';
2. Set the password for the user
mysql> Update user set Password=password (123456);
Mysql>flush privileges;
Create MySQL users and give them permissions
1. Create a user and set a password
mysql>create user [email protected] ' localhost ' identified by ' 123456 ';
mysql>create user [email protected] ' localhost ';
2. Common ways to create a user, create a user, and authorize Grant
mysql> Grant all on blog.* to ' acbuf ' @ ' localhost ' identified by ' 123456 '; does not automatically create Blog Library
3. Authorization Library for an existing user.
Mysql> Grant all on blog.* to [email protected] ' localhost ';
4. View User Permissions
Mysql>show grants for [email protected] ' localhost ';
5.root password forgot reset password
1. Edit /etc/my.cnf add skip-grant-tables in the [mysqld] segment, and then restart Mysqld.
Then MySQL enters and then update sets the password for root
, the added skip-grant-tables will be removed after the setup is complete.
2.[[email protected]/]# mysqld_safe--skip-grant-tables--user=mysql &
The next steps are the same as the first method.
This article is from the "Dong Shuhao" blog, make sure to keep this source http://dongshuhao.blog.51cto.com/13042423/1945965
MySQL Simple user Management