Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

OS - RHEL 5.5 I have root access to the server. I have also created a user 'mysql' on the seerver. The mysql db was preinstalled for us and user mysql was created as a root user of the db.

Here is what happens If I login to the machine with user mysql, I can access the mysql shell. But when I log in as root, I cannot access the mysql shell even when I do 'su mysql'

Question - What is the reason behind this behavior? Isn't logging in with 'mysql' and changing to user 'mysql' the same things?

share|improve this question

migrated from Sep 12 '12 at 10:36

This question came from our site for professional and enthusiast programmers.

You do mean sudo mysql right? – lc. Sep 12 '12 at 6:15
do want to access mysql database through root user? – user128296 Sep 12 '12 at 10:45

In all likelihood, you have a mysql user without a password.

Try this

mysql -u mysql


su - mysql

The "-" on su makes it a proper login shell, so that all environment variables (and everything else) is set up the same way as logging in directly as that user.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.