I just installed MySQL 5.5 and right after install I was asked to set root password by executing those two commands:
/usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h linux-opxd password 'new-password'
I executed first command -- OK. I executed second command this time with error:
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
I re-executed the first one (for checking) -- error as above.
So, I executed
mysql_secure_installation. Everything went fine and my password was recognized. So I executed the first two commands again -- and error again.
As another check:
The same error as above.
I tried resetting the password with mysql authentication, also I tried
/usr/bin/mysql_upgrade -u root -p -- still the error while trying to launch mysql console as root.
So finally I turned authentication off, connected to console and executed this:
The output --
root@. If I connect like this:
I will get
So for now it seems it is not the problem with privileges, or lack of password or anything like this, but no recognizing the user which was given at command line -- mysql appends
@ at the end and this seems to be the problem (at least for my eye).
The question is: how to make MySQL recognize the given user?