This is related to a bug in mysqladmin failing to properly set the password for an account with auth_socket enabled: http://bugs.mysql.com/bug.php?id=81965 (I'm not sure if secure_installation uses mysqladmin or if it's just the same logic).
When installing the package with an empty root password, the root user will have unix socket authentication enabled, so only the system root user can log in as root. To set a password, the auth plugin must also be reset to mysql_native_password, i.e. with «ALTER USER 'root'@'localhost' IDENTIFIED BY 'passphrase' WITH 'mysql_native_password';» After running secure_installation, can you still log in with «sudo mysql» with no password or user specified? Also note that mysql_secure_installation is largely redundant for a fresh 5.7 installation; The only feature 5.7 doesn't set by default is the password validation plugin. ** Bug watch added: MySQL Bug System #81965 http://bugs.mysql.com/bug.php?id=81965 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1610574 Title: mysql_secure_installation locks out root database user To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1610574/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs