How To Reset MariaDB root Login Password
How To Reset The MariaDB Root Login Password
Pre-requisite:
MariaDB
Procedure:
First Stop the service of MariaDB
[root@linuxhelp ~]# systemctl stop mariadb
Skip the Grant tables and restart the service of Mariadb using the below command.
[root@linuxhelp ~]# mysqld_safe --skip-grant-tables &
[1] 31918
190803 10:09:10 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
190803 10:09:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Login to the MariaDB database using the following command
[root@linuxhelp ~]# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Switch Over to the mysql database
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
Change the Password of root using the following command.
MariaDB [mysql]> update user SET PASSWORD=PASSWORD('linux') WHERE USER="root";
Query OK, 3 rows affected (0.03 sec)
Rows matched: 3 Changed: 3 Warnings: 0
Update the changes done using the below command
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.04 sec)
Now,Exit from the MariaDB database
MariaDB [mysql]> exit
Bye
Restart the Service of MariaDB
[root@linuxhelp ~]# systemctl restart mariadb
Now,Login to the MariaDB database using the new password
[root@linuxhelp ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
With this,MariaDB root login password has been changed successfully and the article comes to end.
Q
What does mysql contain in MariaDB?
A
MySQL is the system database that contains tables which store information required by the MYSQL server.
Q
What is information_schema in MariaDB?
A
In MariaDB,information_schema provides access to database metadata.
Q
What is performance_schema in MariaDB?
A
Performance_schema is a feature in MariaDB for monitoring MariaDB server execution at a low level .
Q
What are the default databases present in MariaDB?
A
The default databases present in MariaDB are mysql,information_schema and performance_schema.
Q
What does grant tables contain in MariaDB?
A
Grant Tables contain information about user accounts and the privileges held by them in MariaDB