Forgot Root Password? MariaDB
- Atul
- Technology , Web , Free software , The big o community , Database , Mariadb
- May 19, 2025
Table of Contents
Forgot Root Password? MariaDB
This error occurs in newer MariaDB versions where the authentication system has changed. Let’s use the correct method for your version:
Since you already ran FLUSH PRIVILEGES;
, try this approach:
# First, restart MariaDB normally
sudo pkill mysqld_safe
sudo systemctl start mariadb
# Try connecting without password (sometimes works after flush privileges)
mysql -u root
If that works, then run:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'PwxOV6nFtKFWff5w8OCjDz5oE3WyBl';
If that doesn’t work, restart in safe mode and use this method:
sudo systemctl stop mariadb
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
Then use the correct column name for newer MariaDB:
USE mysql;
UPDATE user SET authentication_string = PASSWORD('PwxOV6nFtKFWff5w8OCjDz5oE3WyBl') WHERE User = 'root';
FLUSH PRIVILEGES;
EXIT;
Alternative method - try updating the plugin as well:
USE mysql;
UPDATE user SET authentication_string = PASSWORD('PwxOV6nFtKFWff5w8OCjDz5oE3WyBl'), plugin = 'mysql_native_password' WHERE User = 'root';
FLUSH PRIVILEGES;
EXIT;
Then restart normally:
sudo pkill mysqld_safe
sudo systemctl start mariadb
The key difference is using authentication_string
instead of password
in newer MariaDB versions.