0

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?

3
  • 5
    You do mean sudo mysql right?
    – lc.
    Sep 12, 2012 at 6:15
  • do want to access mysql database through root user?
    – user128296
    Sep 12, 2012 at 10:45
  • was the command "su mysql" successful (-> 'whoami')? If not, the shell for the user mysql might have been (by default) defined as '/bin/false' instead of e.g. '/bin/bash'. Jul 20, 2022 at 22:30

1 Answer 1

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.

You must log in to answer this question.