Thursday, April 07, 2011

Slamming the door shut on mysql server access

Has there been a situation when you needed to perform some serious maintenance work on your db server, and you just don't want anyone at all to connect to the db server?

Here's a one liner:
set global init_connect="kill connection_id();"

(I should have posted this 6 days ago)

3 comments:

Anonymous said...

Hi. This doesn't work for users with the SUPER privilege.

I prefer to restart the database on a non-standard port when I need to prevent access for maintenance.

Partha Dutta said...

I know - its more of a gag than anything.

Shlomi N. said...

Nice gag.

You can follow the procedure used by oak-block-account, and simply reverse all passwords in mysql.user

The process is easily reversible (no pun intended)