Thursday, March 9, 2017

Reset the MariaDB Root Password

If you forget your root MariaDB password, it can be reset.

1. Stop the current MariaDB server instance, then restart it with an option to not ask for a password:
sudo systemctl stop mariadb
sudo mysqld_safe --skip-grant-tables &

2. Reconnect to the MariaDB server with the MariaDB root account:
mysql -u root

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;
exit

4. Then restart MariaDB:
sudo systemctl start mariadb

No comments:

Post a Comment