0

Environment

$ uname -a
Linux aurora 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

MySQL

$ mysqladmin --version
mysqladmin  Ver 8.42 Distrib 5.7.16, for Linux on x86_64

Clearly something is trying to log into my mysql server as root upon

service mysql start

but I don't know what it is.

The last line in /var/log/mysql/error.log related to starting the server is:

[Note] Access denied for user 'root'@'localhost' (using password: NO)

How do I figure the offending config file or server or application that is trying to log in as 'root'@'localhost' on startup? What other information can I provide to help to understand and resolve this issue?

Also, I am able to log in as 'root'@'localhost' if I do so explicitly. It's only the [Note] in the error log that is irritating me and that I want to debug.

In order to reduce the number of variables, I've also shutdown apache and deleted my crontab just in case that was part of the problem.

I am open to all suggestions.

Redirected from https://stackoverflow.com/questions/41601069/access-denied-for-user-rootlocalhost-using-password-no-on-service-mysql

2
  • Whether, the service started or not. Note is not an error. Also, if started, check the error log now. In case of Access Denied error, check this page for more analysis rathishkumar.in/2017/04/… May 7, 2017 at 17:34
  • Could you explain my.cnf file?
    – HamoonDBA
    Jul 11, 2017 at 4:49

2 Answers 2

0

I had similar problem.

https://stackoverflow.com/questions/38098505/mysql-works-with-sudo-but-without-not-ubuntu-16-04-mysql-5-7-12-0ubuntu1-1

And solved id following by:

https://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04

sudo mysql -u root
DROP USER 'root'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;
3
  • I think that my problem is not with logging in as root, but rather identifying what startup script/config file is trying to login as root without a password. I didn't think this would help but tried it anyway and have replaced my 'root'@'localhost' with 'root'@'%' but have not seen any change to the startup logs otherwise. Thank you.
    – Vishal
    Jan 12, 2017 at 2:31
  • So your root password to database is empty or not?
    – Daniel
    Jan 12, 2017 at 11:53
  • No. My root password is not empty.
    – Vishal
    Jan 14, 2017 at 3:33
0

You set DB_PASSWORD=secret so pass null to it

DB_DATABASE=abcdef
DB_USERNAME=root
DB_PASSWORD=secret

Change to :

DB_DATABASE=abcdef
DB_USERNAME=root
DB_PASSWORD=

Hope it work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.