How to reset MariaDB root user password
If for some reason you have forgotten the password of your MariaDB database server, you can reset the password with the following steps.
Note: for the execution of the following commands it is necessary to take the session of the root user.
1. stop the execution of our MariaDB database server with the following command:
systemctl stop mariadb
2. We execute the following command so that it does not ask for the password of the root user
mysqld_safe --skip-grant-tables &
3. We connect to our MariaDB database server by executing the following command:
mysql -u root
4. We execute the following command to reset the password of the root user, where (yourpassword) must be replaced by a strong password.
use mysql;
update user SET PASSWORD=PASSWORD("yourpassword") WHERE USER='root';
flush privileges;
exit
5. Finally we restart our MariaDB database server.
systemctl start mariadb