1

I'm upgrading a few mysql (MariaDB) hosts from Ubuntu 14.04 to 16.04 and noticed mysql_secure_installation doesn't seem to set a root password on the DB, even though it prompted me for it.

I changed the root pass from the mysql prompt but later that evening, the logrotate process threw some errors out via email:

/etc/cron.daily/logrotate:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
error: error running shared postrotate script for '/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

I checked the /etc/logrotate.d/mysql-server logrotate script and it's calling mysqladmin:

...
# If this fails, check debian.conf!
mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \
flush-engine-log flush-general-log flush-slow-log
...

Since the comment says to check debian.conf, I checked it:

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = root
password = 
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = root
password = 
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

So.. debian.cnf doesn't have a password set for root by default. In 14.04 this file is populated with the debian-sys-maint account, not root.

I could go back and set my root password in mysql, and then drop that password into /etc/mysql/debian.cnf but I'm really wondering now if something got botched on the install that messed up the debian-sys-main account or is this just the "new" way Mysql is installed?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.