Home   >>   MySQL   >>   How To Reset MySQL Root Password
How To Reset MySQL Root Password PDF Print E-mail
( 1 Vote )
How To - MySQL
Written by Christian Foronda   
Wednesday, 18 May 2011 18:57

Stop MySQL:

Debian/Ubuntu:

# /etc/init.d/mysql stop

Redhat/CentOS:

# /etc/init.d/mysqld stop

 

Start MySQL without password:

# mysqld_safe --skip-grant-tables &

 

Login to MySQL:

# mysql -u root

 

Reset the password:

mysql> UPDATE mysql.user SET password=PASSWORD("NewRootPassword") where User='root';
mysql> flush privileges;
mysql> quit

 

Stop MySQL:

Debian/Ubuntu:

# /etc/init.d/mysql stop

Redhat/CentOS:

# /etc/init.d/mysqld stop

 

Start MySQL:

Debian/Ubuntu:

# /etc/init.d/mysql start

Redhat/CentOS:

# /etc/init.d/mysqld start

 

Login with the new password:

# mysql -u root -pNewRootPassword

 




blog comments powered by Disqus