Drop user deletes all of the user's information, and delete only clears the users table, and other information, such as the DB table, exists.
If you create a user with the least privilege after delete, then he reuses the previous permissions.
Grant all on test.* to ' test ' @ '% ' identified by ' test ';
Delete from user where user =test;
Look at DB table Mysql> select * from DB;
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+---- --------+-----------------+------------+------------+-----------------------+------------------+--------------- ---+----------------+---------------------+--------------------+--------------+------------+--------------+
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+---- --------+-----------------+------------+------------+-----------------------+------------------+--------------- ---+----------------+---------------------+--------------------+--------------+------------+--------------+
| % | test | | y | y | y | y | y | y | n | y | y | y | y | y | y | y | y | n | n | y | y |
| % | test\_% | | y | y | y | y | y | y | n | y | y | y | y | y | Y | y | y | n | n | y | y |
| % | test | Test | y | y | y | y | y | y | n | y | y | y | y | y | y | y | y | y | y | y | y |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+---- --------+-----------------+------------+------------+-----------------------+------------------+--------------- ---+----------------+---------------------+--------------------+--------------+------------+--------------+
3 Rows in Set (0.00 sec)
Permission for test still exists
Create a user with only select test Grant Select on test.* to ' test ' @ '% ' identified by ' test ';
Mysql> select * from DB;
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+---- --------+-----------------+------------+------------+-----------------------+------------------+--------------- ---+----------------+---------------------+--------------------+--------------+------------+--------------+
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+---- --------+-----------------+------------+------------+-----------------------+------------------+--------------- ---+----------------+---------------------+--------------------+--------------+------------+--------------+
| % | test | | y | y | y | y | y | y | n | y | y | y | y | y | y | y | y | n | n | y | y |
| % | test\_% | | y | y | y | y | y | y | n | y | y | y | y | y | Y | y | y | n | n | y | y |
| % | test | Test | y | y | y | y | y | y | n | y | y | y | y | y | y | y | y | y | y | y | y |
+------+---------+------+-------------+-------------+-------------+-------------+-------------+-----------+---- --------+-----------------+------------+------------+-----------------------+------------------+--------------- ---+----------------+---------------------+--------------------+--------------+------------+--------------+
3 Rows in Set (0.00 sec)
permissions are the same as before.
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.