How to Reset MySQL or MariaDB Root Password in Linux

 One of these settings is the password for the database root account — which you must keep private and use only when strictly required.

If you forget the password or need to reset it (for example, when a database administrator changes roles — or is laid off!).

This article will come in handy. We will explain how to reset or recover forgotten MySQL or MariaDB root passwords in Linux.

Although we will use a MariaDB server in this article, the instructions should work for MySQL as well.

To begin, stop the database service and check the service status, we should see the environment variable we set previously:

------------- SysVinit -------------
# /etc/init.d/mysqld stop

Next, start the service with

------------- SysVinit -------------
# mysqld_safe --skip-grant-tables &

Start MySQL/MariaDB with Skip Tables

This will allow you to connect to the database server as root without a password (you may need to switch to a different terminal to do so):

From then on, follow the steps outlined below.

Finally, stop the service, unset the environment variable and start the service once again:

------------- SysVinit -------------
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

This will cause the previous changes to take effect, allowing you to connect to the database server using the new password.

Summary:-

In this article, we have discussed how to reset the MariaDB / MySQL root password. As always, feel free to use the comment form below to drop us a note if you have any questions or feedback. We look forward to hearing from you!

Services Cloudtechtiq offers:

Comments

Popular posts from this blog

How Much Does SSL Certificates Price?

Most Ideal Ways To Buy An SSL Certificate

Managed VPS Hosting Server: Power, Versatility, and Inside Energy of Understanding