Please note that if you haven't changed over to MariaDB - you should ... But more to the point for this post - if you need to reset your root mysql or mariadb password, the easiest way to do it on an Ubuntu platform is to run the following commands: First, you need to know what version of mysql or MariaDB you have, so run this to search for the package name:
root@bazingah:/usr/local/bin# dpkg-query -S mariadb-serverFor MySQL users the command would be:
dpkg-query -S mysql-serverOnce you have your package name, you can run the reconfigure command on it: (in my example, the mariadb version is 5.5, which is a match for the MySQL version that is current: "mysql-server-5.5"
sudo dpkg-reconfigure mariadb-server-5.5