Reputation: 2336
OS
$ 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.
Upvotes: 1
Views: 3415
Reputation: 3246
This is because the mysqladmin cannot login as root.
The guilty is this Systemd unit:
/lib/systemd/system/mysql.service
Which executes this command to see if the daemon is started properly:
ExecStartPost=/usr/share/mysql/mysql-systemd-start post
Which executes:
# mysqladmin ping
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
# echo $?
0
The return value is 0 despite the error message so the daemon is marked as started.
Debian has a file which contains an user to execute unattended operations, to use this file explicitly the previous command must be executed in this manner:
mysqladmin --defaults-file=/etc/mysql/debian.cnf ping
After this explanation I can ignore the line in the error log.
Upvotes: 4