Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Sep 12 '12 at 10:36

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

5  
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
add comment

1 Answer 1

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

Try this

mysql -u mysql

Or

su - mysql
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
add comment

Your Answer

 
discard

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