Remove privileges from MySQL database

后端 未结 2 1799
日久生厌
日久生厌 2021-01-30 06:45

Before you think this is a duplicate question, I believe I have a unique, even if it is somewhat dim-witted, case.

A few days ago, I upgraded the version of MySQL on my

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-30 07:04

    As a side note, the reason revoke usage on *.* from 'phpmyadmin'@'localhost'; does not work is quite simple : There is no grant called USAGE.

    The actual named grants are in the MySQL Documentation

    The grant USAGE is a logical grant. How? 'phpmyadmin'@'localhost' has an entry in mysql.user where user='phpmyadmin' and host='localhost'. Any row in mysql.user semantically means USAGE. Running DROP USER 'phpmyadmin'@'localhost'; should work just fine. Under the hood, it's really doing this:

    DELETE FROM mysql.user WHERE user='phpmyadmin' and host='localhost';
    DELETE FROM mysql.db   WHERE user='phpmyadmin' and host='localhost';
    FLUSH PRIVILEGES;
    

    Therefore, the removal of a row from mysql.user constitutes running REVOKE USAGE, even though REVOKE USAGE cannot literally be executed.

提交回复
热议问题