To learn more about MariaDB, check this out:
This tutorial will explain to you how to change the password for a MariaDB user. We will perform the task using the Linux command line with the help of a few easy-to-follow commands. We have divided the guide into two parts. In part 1, we will change the MariaDB user password, and in part 2, we will change the MariaDB root password.”
Without any further ado, let’s get started!
Part 1: Change MariaDB User Password
In this section, you will see how to change MariaDB’s normal user password.
First, open the command line and log into MariaDB as the root user using this command:
The next step is to switch to the mysql database by executing the following command:
Using the following syntax, switch the user’s password:
Make sure to replace the user and password with your user and password.
Now refresh the privileges by using the following command:
Now exit the database:
Let’s now check if the changes we made are working by trying to re-login the database with the new password:
Part 2: Change MariaDB Root Password
In this section, you will see how to change the MariaDB root password.
Start with stopping the running MariaDB database instance. Do that by issuing the following command:
Next, start the database again with –the skip-grant-tables option, which will let us connect with the DB without having to provide a password. This can be done by executing the below-mentioned command:
Now you can log in as root without giving the root password with this command:
Refresh the privileges with the FLUSH command like this:
After that, change the root password using the command mentioned below:
Make sure to replace the word password with your password.
Next, exit the database like this:
Once we have exited the DB, we will terminate the current mysqld process with this command:
Next, start your MariaDB server backup by executing the following command:
The last step is to verify if the root password we just changed is working or not. It can be done by trying to log in to MariaDB using the new root password.
In today’s tutorial, we saw in detail how to change the password for a user in MariaDB. First, we explored how to change a normal user password. Next, we saw how to change the root user password.
I hope you liked the tutorial.