MySQL Simple user Management

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.