Becasue it’s such a good article and don’t want to lose it, this following article is a full copy (with maybe some minor changes) taken from this site:

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.
# kill $(ps aux | grep -v 'grep' | grep /usr/bin/mysqld_safe | awk '{print $2}')
# 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)]>

Well, after having done all of the above I could sign-up as root via the command line ‘mysql -u root -p’ but could not sign-up as root via PHPMyadmin.
So here is what I did:
Step 6: login as root using this command:
# mysql -u root -p
Step 7: Enter the following commands to create the new user ‘root2’ and set the same password as for ‘root’
MariaDB [(none)]> use mysql;
MariaDB [mysql]> CREATE USER 'root2'@'localhost' IDENTIFIED BY 'same_pass_as_root';
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root2'@'localhost' WITH GRANT OPTION;
MariaDB [mysql]> quit;

I could then login as ‘root2’ in PHPMyadmin and have all privileges as for root.
That works and don’t ask me why đŸ˜‰

%d bloggers like this: