0

I just installed MySQL on Debian 6.

With PHPMyAdmin I noticed there are already 4 MySQL users:

debian-sys-maint (localhost)
root             (127.0.0.1)
root             (localhost)
root             (myhostingcompanyurl)

Are all of those necessary?

1

1 Answer 1

2

The answer is "sort of". The debian-sys-maint one is definitely necessary, Debian uses it to perform automatic maintenance like rotating logs.

The three different root accounts are because MySQL treats your host address as part of your account, so even with the same username, you might get a different account depending on how you connect.

'root'@'localhost' is an account using "root" as their username who connects to MySQL via the socket file (eg /var/run/mysqld/mysqld.sock).
'root'@'127.0.0.1' is an account using "root" as their username who connects via TCP/IP coming from the 127.0.0.1 IP address.
'root'@'myhostingcompanyurl' is an account using "root" as their username who connects via TCP/IP coming from an IP address that reverse-resolves to myhostingcompanyurl.

If you don't want to have different permissions for people calling themselves root depending on how they connect to the server, you could create a 'root'@'%' account, where % will match any connection's hostname, keeping in mind that you lose security in the case that 'root'@'someforeigncountry' figures out how to connect. Then you could remove the three specific accounts.

You can find out more about how accounts are made up of usernames and hostnames in the mysql documentation here, and the "special meaning" of localhost here.

2
  • 1
    Also note that even if you use 'root'@'%', you still need a separate 'root'@'localhost' if you want to connect through the socket.
    – Brian
    Feb 10, 2011 at 0:51
  • Read /usr/share/doc/mysql-server-5.5/README.Debian.gz for more information that any administrator on a Debian based system should know about MySQL.
    – Anders
    Jan 2, 2015 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.