MariaDB or MySQL Query Remove Root Password



Frist of all login as root

$ sudo mysql


Now on MySQL terminal

$ GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY '' WITH GRANT OPTION;

$ FLUSH PRIVILEGES;

$ exit


Note : if still can't accessible, try command bellow.

$ SET PASSWORD FOR root@localhost=PASSWORD('');

$ FLUSH PRIVILEGES;

$ exit


For MySQL 8.0, try these.

$ ALTER USER 'root'@'localhost' IDENTIFIED BY '';

$ FLUSH PRIVILEGES;

$ exit


Source :

https://stackoverflow.com/questions/3032054/how-to-remove-mysql-root-password

https://www.tecmint.com/reset-root-password-in-mysql-8/

https://stackoverflow.com/questions/50691977/how-to-reset-the-root-password-in-mysql-8-0-11

Comments