MariaDB password generator

You can easily generate the MariaDB password.





Step 1: Finding MariaDB Version

Find out the version of MariaDB database server you’re running by running the commands below:

mysql --version

When you run the commands above, it will show you the version of MariaDB installed…

mysql Ver 15.1 Distrib 10.1.33-MariaDB

Take notes of the version of either database you’re running… You will need it below.

Step 2: Reset User Password

Now that you know the version of the database server you running, run the commands below to logon to the database…

sudo mysql -u root -p

Type in the root password and logon..

Then type the following commands if you are running MariaDB 10.1.20 and later to reset or change a user password:

ALTER USER 'username'@'localhost' IDENTIFIED BY 'NEWPASSWORD';
FLUSH PRIVILEGES;

Replace username and NEWPASSWORD with the username and new password you want to use for the user…

If the ALTER statement doesn’t work, you can run the commands below to change it…

UPDATE mysql.user SET authentication_string = PASSWORD('NEWPASSWORD')
WHERE User = 'username' AND Host = 'localhost';
FLUSH PRIVILEGES;
exit;

Exit and that should do it.

For MariaDB 10.1.20 and earlier, use the commands below to change the user password

SET PASSWORD FOR 'username'@'localhost' = PASSWORD('NEWPASSWORD');
FLUSH PRIVILEGES;
exit;

Close out and you’re done.

If the commands were executed successfully, you should get a Query OK responses..

That should do it for you…

Congratulations! You have successfully change MariaDB user password… This should apply to all modern Linux systems running the databases mentioned above…