Ubuntu – Thesql error 1045(280000) access denied for user ‘debian-sys-maint ‘@’ localhost using password ‘yes’

MySQL

I edited deian.cnf to change the password of mysql (ubuntu server)

sudo vi /etc/mysql/debian.cnf

I change

user=debian-sys-maint password=*

to

user=debian-sys-maint

password=mypassword

then I tried to enter console of mysql

mysql -udebian-sys-maint -p

and inputed password 'mypassword'

it reported

mysql error 1045(280000) access denied for user 'debian-sys-maint '@' localhost using password 'yes'

I tried to remove mysql and reinstall, the error is same.

Your comment welcome

Best Answer

The error message tell you that, your password is wrong or the account debian-sys-maint has no access to the database on host localhost.

If you are sure your password is correct you should grant all privileges like this:

login as root first

mysql -u root -p <password>

then, grant full permissions:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'your password';

restart mysql and see if the error message is gone.