How to reset root password of mariadb / mysql on Rocky Linux 8
1. Stop all service of mysql /mariadb $ sudo systemctl stop mariadb # sudo systemctl stop mysql 2. Skip authentication of login $ sudo mysqld_safe --skip-grant-tables --skip-networking & # skip authentication $ mysql -u root # Important for non-sudo login mysql 3. Clean unix_socket in database.table of mysql.user > update mysql.user set plugin=""; 4. Check status of plugin from mysql.user > select user, plugin from mysql.user; 5. Reset password > update mysql.user set password=password("") where user="root"; #reset password to empty > flush privileges; > quit 6. Kill process of mariadb or mysql hanging on $ sudo pkill mariadb # sudo pkill mysql $ sudo ps -aux | grep mysql # check status about mysql process $sudo systemctl restart mariadb $mysql -u root -p 7. Login with empty password. references https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password https...