It’s really annoying to forget what your MariaDB’s root account password is. However, with just a little commandline effort, it’s an easy challenge to resolve. I learned most of these instructions with this Digial Ocean article. It’s a great article but it instructions for ending the MariaDB mysqld process didn’t work for me on Ubuntu 17.04.

Stop MariaDB
Restart the database without permission checking

This command doesn’t seem to finish. After about 30 seconds or press enter to get back to a command line and go to the next step.

Connect to database with root
Reload grant tables with FLUSH PRIVILEGES
Reset root password

Exit MySQL with

Find and kill the mysqld process

The command below lists the mysqld processes.

On my system, the mysqld process to kill is the one associated with user mysql and /usr/sbin/mysqld as shown below.

Kill the /usr/sbin/mysqld process with

Restart MariaDB

You should now be able to log back into MariaDb with:

You’ll be prompted for the password; enter the one you just assigned to the root account.

Leave a Reply

Your email address will not be published. Required fields are marked *