Friday, September 2, 2022

How to find temporary MySQL Root Password after installation

 Sometimes once MySQL installation is done. You will not be able to find the temporary password, here I was working on the latest MySQL version 8.0.30-commercial MySQL Enterprise Server.

[root@Sajidserver01 ~]# grep -i pass /var/log/mysqld.log

Remove the /var/lib/mysql and restart mysqld as below

[root@Sajidserver01 ~]#cd /var/lib
[root@Sajidserver01 ~]#rm -rf mysql 
[root@Sajidserver01 ~]#systemctl stop mysqld
[root@Sajidserver01 ~]#systemctl start mysqld

Once it is done, you will find the new temporary password generated in mysqld.log below.

[root@Sajidserver01 ~]# grep -i pass /var/log/mysqld.log 
2022-09-01T21:32:34.029030Z 6 [Note] [MY-0454] [Server] A temporary password is generated for root@localhost: S2<3!chrde

Once it is done you can reset your password as per your standards using /usr/bin/mysql_secure_installation.


No comments:

Post a Comment