Reset the MariaDB Root Password

Reset the MariaDB Root Password

Incase you forgot your MariaDB root password, you can reset it using the below Steps

Step:1 Stop the running MariaDB server, and  restart it with an option to not ask for a password:

sudo systemctl stop mariadb
mysqld_safe --skip-grant-tables &

Step:2 Reconnect to the MariaDB server with the MariaDB root account:

mysql -u root

Step:3 Use the following commands to reset root’s password. Replace (“password”) with a strong password:

use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;

Step:4 Then restart MariaDB:

sudo systemctl start mariadb