Search

Don’t remember MySQL Root Password?

If you don’t remember your MySQL root password, you can follow the steps below to reset it to a new value. The following example uses MySQL with Bitnami Ubuntu instance. Substitute the directory paths with where you have MySQL installed.




Create a file in /home/bitnami/mysql-init with the content shown below (replace NEW_PASSWORD with the password you wish to use):


UPDATE mysql.user SET Password=PASSWORD('NEW_PASSWORD') WHERE User='root'; FLUSH PRIVILEGES;


If your stack ships MySQL v5.7.x, use the following content instead of that shown above:


UPDATE mysql.user SET authentication_string=PASSWORD('NEW_PASSWORD') WHERE User='root';

FLUSH PRIVILEGES;


TIP: Check the MySQL version with the command


/opt/bitnami/mysql/bin/mysqladmin --version


or


/opt/bitnami/mysql/bin/mysqld --version.


Stop the MySQL server:


sudo /opt/bitnami/ctlscript.sh stop mysql



Start MySQL with the following command:


sudo /opt/bitnami/mysql/bin/mysqld_safe --pid-file=/opt/bitnami/mysql/data/mysqld.pid --datadir=/opt/bitnami/mysql/data --init-file=/home/bitnami/mysql-init 2> /dev/null &


Restart the MySQL server:


sudo /opt/bitnami/ctlscript.sh restart mysql


Remove the script:


rm /home/bitnami/mysql-init





Need more details?
Contact us

We are here to assist.

email : info@innofoundry.com 
phone : +1 (415) 669-4289

Location: Austin, Texas, United States

© 2009 - 2018 Innofoundry LLC. 
Innofoundry® is a Registered Trademark of Innofoundry LLC