Here is a tips for the case that if you forgot MariaDB root account password, You can simply change it using following steps. For you information MariaDB root user is different that Linux system root account.

Follow the step by step guide to reset MariaDB root user password in Linux systems.

Step 1: Stop MariaDB Service

First we need to stop MariaDB service using following command.

# /etc/init.d/mysql stop
Shutting down MySQL.                [  OK  ]

Step 2: Start MariaDB in Safe Mode

Now connect to MariaDB in safe more using skip grant and run this command in background.

# mysqld_safe --skip-grant-tables &

[1] 6218
140118 22:27:09 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
140118 22:27:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Step 3: Login to MariaDB and Change Password

After starting MariaDB in safe more connect to MariaDB and run following commands to change root password.

# mysql

MariaDB [(none)]> use mysql;
MariaDB [mysql]> UPDATE user SET password=PASSWORD("new_password") WHERE User='root';
MariaDB [mysql]> quit;

Step 4: Stop and Start MariaDB

After changing password, stop the MariaDB service and start it again in normal mode using following commands.

# service mysql stop
# service mysql start

Step 5: Login to MariaDB using New Password

At this stage you have successfully updated you root MariaDB password, Lets connect to MariaDB using new password.

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 1
Server version: 5.5.34-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>

Comments powered by CComment