How to reset MariaDB password

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

If you have any questions, please feel free to contact Picaraza Domains Ltd support team 24/7/365.
Was this answer helpful?

Related Articles

PostgreSQL installation on CentOS 7

For the installation of our PostgreSQL database, we need to log in to our server with the...

MariaDB installation

MariaDB is an open source relational database management system, compatible with previous...

How to improve MariaDB security

Executing the command (mysql_secure_installation) we can increase the security of our MariaDB...