When I am root, "mysql" connects without a password, even though I've set one:

# mysqladmin -u root password 'whatever'
# mysql -u root -p
Enter password: (typing the 'whatever' above)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.22-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> Bye

but unfortunately this also happens...

# mysql -u root 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 25 to server version: 4.1.22-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

So even though I've set the password, and it IS checked when I use "-p", it is however not necessary!?!?

EDIT: It was my .my.cnf, it had the login password inside it. Removed it, all OK.

link|improve this question
1  
Add your "Edit" as answer please. – Lekensteyn Jun 11 '11 at 9:51
Cross-post: webmasters.stackexchange.com/q/15130/6597 – Lekensteyn Jun 11 '11 at 9:52
@John-Smith : We're here to help but good education is always welcome, you've found the solution to your problem but I couldn't see a "thank you"... if you don't get help in the future don't complaint... – Tuga Aug 20 '11 at 21:40
@tuga - this is the second comment that I've seen where you criticize people for not saying "Thank You," I'm not sure why you feel the need to do this. It's a Q&A site and we prefer to keep the clutter to a minimum. In fact, users cannot even say "thanks in advance" at the bottom of their questions - it is automatically edited out. Please stop berating users for this, you are wrong. If you have a problem you can bring it up on Meta Server Fault – MDMarra Aug 27 '11 at 21:41
feedback

2 Answers

Maybe you have user credentials in your ~/.my.cnf

[client]
user=john
password=smith
link|improve this answer
feedback

Do you have "skip-grant-tables" enabled in your my.cnf file?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.