4

I'm currently experiencing a weird problem with one of my MySQL database servers:

It stopped asking for passwords when I try to access the database from local with the mysql command line tool.

I need a valid admin username. I also still need a password for remote access (i.e. from another IP). And I need a password when I - for example - access the database from a PHP script. But when I try to access the database from local host/commandline it will let me straight in to the data with my administrative users.

They (admin users) have passwords set - and as I mentioned - I still need to specify those when I try to access the data via PHP.

Changing the password didn't help.

Non-Administrative users need to specify their passwort, but that doesn't really help if they can get anywhere with "mysql -u root" (or another admin user account name).

(System Debian Linux Lenny, MySQL 5.0.51a)

Any ideas? Anything that explains this behaviour? I don't understand how this can happen.

1 Answer 1

5

Are you the sole admin of the system?
If not, I guess someone else has created a file named "/root/.my.cnf", containing login-credentials. Can you verify this?

5
  • Great, that fixed my problem. Looks like my colleague created such a file... grr
    – BlaM
    Jun 25, 2011 at 16:08
  • I can't blame your colleague for that - I (almost) always create such a file. :-)
    – Henk
    Jun 25, 2011 at 19:26
  • Fixed for me too.
    – chuckedw
    Oct 10, 2022 at 13:50
  • Is there a way to force the mysql client to prompt for a password even if ~/.my.cnf exists?
    – Alex
    Jul 27, 2023 at 19:53
  • Nvm, found it. Use mysql --defaults-file= .... It has to remain as a first arg, right after mysql , and contains an empty space for no defaults file.
    – Alex
    Jul 27, 2023 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .