2

I'm getting this error when

softweb:~ # mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I'm not even inputting the password and its telling me that I'm giving one. in the my.cnf file there is no login saved.

If I change the password to the one I had before I can log in without writing -pXXXX so my problem is that I don't want to be able to log in without explicitly writing -pXXXX.

I tried to completely uninstall mysql and reinstall (erasing everything i could find that it had something to do with mysql) but it still has somehow that password saved. I'm using SLES 11 SP1 and 5.1.51-community MySQL Community Server.

Any help would be really appreciated.

1 Answer 1

2

Bit of a guess here - I'm remembering back a good few years - but it's possible there's a file in your home directory (one of the hidden .something ones) which contains your password, independent of your actual MySQL installation. MySQL knows to use this in the absence of a specified one.

Try:

cd
grep <your-password> *
grep <your-password> .*

and see if there's such a file. If so you can delete it (the whole file or just the password value, depending on what else is there!)

Edit: added 2nd grep, * alone won't pick up .* files (at least not on the UNIX I tried it on!)

5
  • first of all thanks. I tryed this before but manually and i couldn't find anything now I tryed the brute force way cd / grep -r XXXXX * and still haven't found anything :(
    – mexican_75
    Oct 14, 2010 at 9:44
  • I've made an edit: try grepping .* in your home dir rather than just *, I've just realised * won't pick up the .something files
    – Brian
    Oct 14, 2010 at 10:08
  • Thanks a lot!. how did it got there in the first place? I never wrote my login on my.cnf and I found it on /root/.my.cnf is that a config file from mysql as well or only the other one in /etc ??
    – mexican_75
    Oct 14, 2010 at 11:19
  • /root/.my.cnf is probably a mysql config file as well. Each user can have their own .my.cnf in their home directory. See dev.mysql.com/doc/refman/5.0/en/option-files.html for more info.
    – titanoboa
    Oct 14, 2010 at 11:57
  • Cool; not sure how it got there to be honest but I'd guess it must have been the install? Glad you found it anyway :-)
    – Brian
    Oct 14, 2010 at 11:59

You must log in to answer this question.