Access denied for user 'root'@'localhost' using Password NO
-
09-10-2020 - |
Question
I have enabled SQL SLOW LOG Queries in my.cnf file but i need to restart mysql and when i try to run this command
sudo /etc/init.d/mysql restart
for restarting it throws this error.
Stopping MySQL database server: mysqld failed!
Starting MySQL database server: mysqld already running.
Warning: World-writable config file '/etc/mysql/debian.cnf' is ignored
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
[Image] :
Solution
It's due to incorrect permissions on /etc/mysql/debian.cnf file.
Do a long-listing of that file first to check current permissions:
sudo ls -l /etc/mysql/debian.cnf
If group or other fields has write permission enabled, run:
sudo chmod 644 /etc/mysql/debian.cnf
and then restart mysql:
sudo /etc/init.d/mysql restart
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange