I am running Ubuntu 18.04 (Server version: 5.7.28-0ubuntu0.18.04.4 (Ubuntu)) and have done a fresh mysql installation. I've used mysql_secure_installation and set a root password. However when I then go (logged in as root) mysql -u root -p and enter a blank password I am still able to login to the MySQL server. I've done flush privileges, I've tried Unable to set mysql root password and I notice a similar (but unanswered) issue here: mysql_secure_installation on Ubuntu 16.04 doesn't set the root pass.
Why would MySQL not store/save the root password? Interestingly if I try to connect as a non-root user I am not able to connect with empty OR the password.
~/.my.cnfwith the credentials in it in the/rootlocation? What if you set your root password within the mysql context? Did you restart mysql after it?