Mysql – What are the default settings for accessing MySQL remotely

MySQL

What is default settings in MYSQL for Remote access?

In CentOS the file /etc/my.cnf does not have skip-networking or bind-address. MySQL Version is 5.5, does it mean the server is enabled for remote access?

MySQL restart failed after adding skip-networking and bind-address=127.0.0.1 in my my.cnf file, so how can I disable remote access?

my.cnf

[mysqld]
skip-networking
innodb_file_per_table=1
innodb_file_format=barracuda
innodb_strict_mode=1
default-storage-engine=MyISAM
long_query_time=5
log_slow_queries=ON
thread_cache_size=32
key_buffer_size=64M
table_open_cache=1000
max_connections=300
query_cache_type=2
query_cache_limit=32M
query_cache_size=160M
max_heap_table_size=256M
tmp_table_size=256M
wait_timeout=360
interactive_timeout=360
max_allowed_packet=16M
sort_buffer_size=8M
innodb_buffer_pool_size=256M
innodb_log_file_size=64M

Best Answer

You will have to resort to removing remote access from the MySQL users themselves.

To find out who has remote access, run this

SELECT user,host from mysql.user
WHERE host NOT IN ('localhost','127.0.0.1');

This will show you everyone that can login to MySQL from specific access points as well as broader network specifications.

You could run the utility mysql_secure_installation which do the following:

  • You can set a password for root accounts.
  • You can remove root accounts that are accessible from outside the local host.
  • You can remove anonymous-user accounts.
  • You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_. (I posted a question and answer about this weird aspect).

UPDATE 2013-07-02 13:11 EDT

I see you have skip-networking in the my.cnf and you removed bind-address=127.0.0.1. I don't think the two options belong together. Why?

The option skip-networking disables TCP/IP. Using 127.0.0.1 as a bind-address implies TCP/IP. The two can never really mix. They are meant to be mutually exclusive. Use one or the other, not both at the same time. This makes sense because when you read the MySQL Documentation for skip-networking and bind-address, one does not mention the other.