MySQL: how to deny remote client access to MySQL temporarily

Say, you’re going to do a “dump” and you don’t want remote clients to alter the current data…

Here’s a simple trick to deny access to remote clients temporarily.

1. open your MySQL configuration file, my.cnf (in CentOS / Red Hat, located in /etc/my.cnf)
2. add skip-networking flag under [mysqld], like this:


3. restart your MySQL server (in CentOS / Red Hat, run service mysqld restart)
4. Do a simple test to verify.

Note that this will affect remote clients only, local clients can still connect via Unix sockets.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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