Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the user management of MySQL?

Shulou Source: shulou.com Published: 2022-05-31 17:30:34 09月21日 Update

MySQL user management is how, for this problem, this article details the corresponding analysis and solution, hoping to help more small partners who want to solve this problem find a simpler and easier way.

One security policy after mysql installation is to delete null users and users whose host is not localhost

1. Delete empty user

Delete empty user

mysql> select mysql.user,host,password from user whereuser =''; query user

mysql> delete from user where user=''; #delete user= null

Remove users whose host is not equal to localhost

mysql> select user,host,password from user where host!= 'localhost';

mysql>delete from user where host!= 'localhost';

2. Set password for user

mysql> update user set password=password(123456);

mysql>flush privileges;

Create mysql users and grant user privileges

1. Create user and set password

mysql>create user acbuf@'localhost' identified by'123456';

mysql>create user acbuf@'localhost';

2. Common methods of creating users; creating users and authorizing grants at the same time

mysql> grant all on blog.* to 'acbuf'@'localhost' identified by '123456'; #blog library not automatically created

3. Authorize libraries for existing users.

mysql> grant all on blog.* to acbuf@'localhost';

4. View User Rights

mysql>show grants for acbuf@'localhost';

5.root Password Forgot to reset password

1. Edit/etc/my.cnf to add skip-grant-tables to the [mysqld] section and restart mysqld.

Then mysql can enter, and then update to set the password for root

After setting, delete the added skip-grant-tables and restart.

2. [root@test /]# mysqld_safe--skip-grant-tables --user=mysql &

The next steps are the same as the first method.

About MySQL user management is how the answer to the problem shared here, I hope the above content can be of some help to everyone, if you still have a lot of doubts not solved, you can pay attention to the industry information channel to learn more related knowledge.

Tags: Users passwords methods questions management more permissions help answers easy secure easy content at the same time guys partners that is commonly used steps knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS Huawei vpn OPPO Reno