Mysql – Enabling remote access to thesql on debian

debianMySQLSecurity

I need to enable remote access for a specific user on a mysql server, running debian oldstable.

Bear in mind I'm no SQL expert nor a real sysadmin.

Logging in phpmyadmin and looking at the Privileges page, I notice two odd things:

  1. an "Any" user, with host %, no password, and global USAGE privilege. No idea what does that mean or imply. If I "edit" that user, I see it has a lot of privileges on a table called test and on a test\_%, whatever that means – please notice I have no such tables in my database, at least they do not appear in the phpmyadmin list.
  2. root both have a line for "localhost" host, and for "127.0.0.1" host.

Point 2 is fine, just odd, seems a bit redundant and senseless to me. Point 1 is what worries me, what am I supposed to do about that?

Best Answer

In response to your questions.

The "Any" user and the "test" database are used by mysql during installation to check that the database was installed properly. You can safely remove both after the installation.

I am unsure about the redundancy in the root user "localhost" and "127.0.0.1". Mysql probably just does that to be safe.

To allow remote access, you will need to edit the file /etc/mysql/my.cnf to make mysql bind to external interfaces. By default, mysql will only accept connections from localhost for security reasons. Follow the instructions given here.

After that, create a new user and give it the user's ip or '%' for all ips and restart mysql. The remote user should now be able to connect to the mysql instance.