I have had problem with mysql. I tried to execute this:
echo "show databases" | mysql -B -N
But I got:
ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)
But when I exec:
/etc/init.d/mysql restart
I got an ‘OK’.
I did
GRANT ALL PRIVILEGES on *.* TO debian-sys-maint@localhost IDENTIFIED BY PASSWORD 'your password' WITH GRANT OPTION; FLUSH PRIVILEGES;
where password is from /etc/mysql/debian.cnf. But it didn’t help. (of course I flushed priv and restarted mysql).
The problem is, your
GRANTstatement usesIDENTIFIED BY PASSWORDclause, and in this case mysql expect to get a hashed password, not a plaintext one.Use
IDENTIFIED BY 'your password'instead, if you wish to supply a plaintext password.