I have installed mysql-server. When I run User Administration Tool it only shows my user name (myname) and root. When I want to add mysql user it says that user mysql already exists but it doesn't shown on the User Administration Tool user list why? I checked the user list

cat /etc/passwd

and I can see the mysql user. After thanI set up a home directory for mysql user

sudo usermod -d /home/mysql mysql

then I change user to mysql

sudo -s -u mysql

after then I want to go to home directory of mysql user.

cd ~

it shows /home/myname not /home/mysql I checked /etc/passwd and it show /home/mysql as a home directory for mysql user. Why it is like that?


First of all, you'll probably find that your User Administration tool doesn't show system accounts (usually user id less than 1000 on Ubuntu), which is why you're only seeing yourself and root, and why you can't add a mysql user, but you can see it in /etc/passwd.

Secondly, you'll probably find that the mysql user has something like /bin/false as their shell, so you'll change to their account, run /bin/false which will exit straight away and therefore log you out again. This will leave you as your account, which would explain why you're seeing your home directory.

Alternatively, it might be because you used sudo -s rather than sudo -i to get a shell. You should not use sudo -s if you want a shell, as -s will not replace all of the environment. Certain variables will still refer to the previous user. I believe that $HOME is one of those variables.

  • Thanks David. it is /bin/bash I tried first sudo -i as you said and become root then I wrote su mysql and then pwd voila it show /home/mysql. I cant vote you because I dont have repution but you solved thanks a lot. – rainman Jul 28 '09 at 15:29
  • You can now :) not that it matters, as I can't get any more reputation today :) – David Pashley Jul 28 '09 at 17:07
  • Thanks David. I voted you when I saw the repution. It was a good answer anyway:-) – rainman Jul 28 '09 at 21:44

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.