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: ------------- SystemD ------------- # systemctl stop mariadb ------------- SysVinit ------------- # /etc/init.d/mysqld stop Next, start the service with --skip-grant-tables : ------------- SystemD ------------- # systemctl set-environment MYSQLD_OPTS= "--skip-grant-tables" # systemctl start mariadb # systemctl status mariadb ------------- SysVinit ------------- # mysqld_saf...