Reset the root password for MariaDB (or MySQL)

By donmc, 16 December, 2014
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-server
mariadb-server-5.5: /usr/share/doc/mariadb-server-5.5/copyright
For MySQL users the command would be: dpkg-query -S mysql-server Once 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