LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 04-16-2007, 08:30 AM   #1
paulsiu
Member
 
Registered: Apr 2006
Posts: 143

Rep: Reputation: 15
MySQL: Why are there two roots localhost, and localhost.localdomain?


I installed MySQL recently. The first thing I did was try to change the password and remove anonymous login. However, when I select the user table, I notice that by default there are two root account and two anonymous accounts. One is for localhost and the other is for localhost.localdomain. I am not knowledgable about networking, what's the difference between localhost and localhost.domain?

Paul
 
Old 04-16-2007, 08:36 AM   #2
Jzarecta
Member
 
Registered: Dec 2005
Location: Villahermosa, Bucharest, Birminham, Brooklyn, Beverly
Distribution: Mandriva
Posts: 118

Rep: Reputation: 15
Talking

is kind of like an alias, I might not try to explain it because I will get it wrong. However I wanted to tell you that you can easily automate the post-installation process by executing the mysql_secure_installation command from the shell. It's a text-wizard that automate the root password, delete test tables, etc.
 
Old 04-16-2007, 09:26 PM   #3
paulsiu
Member
 
Registered: Apr 2006
Posts: 143

Original Poster
Rep: Reputation: 15
I read through the documentation again. Basically, when you install MySQL, it actually creates two accounts. One is for access from the local machine, the other allow remote access. I assume that localhost is for local access and localhost.localdomain is for remote. You also have two accounts for anonymous login.

Note that this dual account only applies to Linux. When you install MySQL on windows, there is only one account.
 
Old 04-16-2007, 10:06 PM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
I would also remove the remote root account for security. So you start with only a root user that can only access mysql from the machine itself.
 
Old 04-17-2007, 12:05 AM   #5
Jzarecta
Member
 
Registered: Dec 2005
Location: Villahermosa, Bucharest, Birminham, Brooklyn, Beverly
Distribution: Mandriva
Posts: 118

Rep: Reputation: 15
Quote:
Originally Posted by Wim Sturkenboom
I would also remove the remote root account for security. So you start with only a root user that can only access mysql from the machine itself.
Even then I think the best option is to go into the /etc/my.cf file and set the skip-networking.

Quote:
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
skip-networking
 
Old 04-18-2007, 07:25 AM   #6
paulsiu
Member
 
Registered: Apr 2006
Posts: 143

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Jzarecta
Even then I think the best option is to go into the /etc/my.cf file and set the skip-networking.
That's assuming that the web server is on the same machine as the MySQL? If that's the case, you can't turn off networking.

Reading through the documentation, one of the recommendation is to run MySQL under another account other than root. This account should have no file permission. That way when mysql is compromised, the attacker can't use the file functionality to get to the rest of the machine. I notice that on my system, mysqld is already running as the user mysql. Either MySQL install this by default or mysql_secure_installation command that Jzarecta mentioned install it that way.

Paul
 
Old 04-18-2007, 09:43 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
To my knowledge, it is by default user/group mysql/mysql.
 
  


Reply

Tags
account, mysql, root, two


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
localhost.localdomain and mySQL? Dark Severance Red Hat 2 04-21-2005 01:21 PM
localhost.localdomain hansi umayangan Linux - General 3 12-23-2004 04:10 AM
localhost.localdomain??? neozero62 Linux - Newbie 2 10-31-2003 10:25 AM
localhost.localdomain KennyK Linux - Software 9 04-17-2003 06:56 AM
localhost.localdomain Garry Galanti Linux - General 1 12-26-2001 05:49 PM


All times are GMT -5. The time now is 09:27 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration