Flush Privileges – MySQL

After creating the user and granting the necessary permissions, reload mysqladmin or restart the MySQL service to enforce the changes. Aside from that, the flush privileges command is another approach to make the provided privileges take effect.

Is this required at all times? No, not always.

FLUSH PRIVILEGES is not required for privileges provided via the GRANT option to take effect. The MySQL server will quickly detect these modifications and refresh the grant tables.

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.

For example,

UPDATE user SET password=PASSWORD(‘password67&’) where user=’someuser’;
SET password for ‘someuser’@’localhost’= password(‘password67&’);

Such modifications will not come into effect immediately. In such cases, FLUSH PRIVILEGES command is needed.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s