MySQL wants a password but it's empty

Posted by gAMBOOKa on Server Fault See other posts from Server Fault or by gAMBOOKa
Published on 2012-01-25T06:12:13Z Indexed on 2012/07/04 15:18 UTC
Read the original article Hit count: 258

Filed under:
|
|
|
|
mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysql -uroot -p
Enter password:       <-- leave blank, hit enter without entering anything

mysql>                <-- i am logged in

NOTE: This is a new mysql instance installation

So if the password is blank, why won't it log me in without a -p flag?

For a little clarification. I am running into this issue when attempting to change the password using a script:

We're using a bash script to do that.

  • mysqladmin -u root password abc wouldn't work (access denied)
  • mysqladmin -u root -p password abc cannot be used because it prompts for a password and we need to automate this.
  • mysqladmin -u root -p'' password abc is not working either

© Server Fault or respective owner

Related posts about linux

Related posts about mysql