MySQL: When is Flush Privileges in MySQL really needed?

Privileges assigned through GRANT option do not need FLUSH PRIVILEGES to take effect – MySQL server will notice these changes and reload the grant tables immediately.

From MySQL documentation:

If you modify the grant tables directly using statements such as
INSERT, UPDATE, or DELETE, your changes have no effect on privilege
checking until you either restart the server or tell it to reload the
tables. If you change the grant tables directly but forget to reload
them, your changes have no effect until you restart the server. This
may leave you wondering why your changes seem to make no difference!

To tell the server to reload the grant tables, perform a
flush-privileges operation. This can be done by issuing a FLUSH
PRIVILEGES statement or by executing a mysqladmin flush-privileges or
mysqladmin reload command.

If you modify the grant tables indirectly using account-management
statements such as GRANT, REVOKE, SET PASSWORD, or RENAME USER, the
server notices these changes and loads the grant tables into memory
again immediately.

Leave a Comment