This article details how to reset a forgotten MariaDB root password. I am not shedding any new light to this, this is here for a quick reference for me. The source of this excellent article is at the bottom of the page.
Stop the service and start MariaDB in safe mode.
service mariadb stop mysqld_safe --skip-grant-tables &
There may be a slight hang, just type mysql
# mysql MariaDB [(none)]> use mysql; MariaDB [mysql]> UPDATE user SET password=PASSWORD("new_password") WHERE User='root'; MariaDB [mysql]> FLUSH PRIVILEGES; MariaDB [mysql]> quit;
Restart the service.
service mariadb restart
Logon as root with the new password.
[root@myserver~]# mysql -u root -p
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 260
Server version: 5.5.50-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.