• Welcome to Web Hosting Community Forum for Webmasters - Web hosting Forum.
 

Recommended Providers

Fully Managed WordPress Hosting
lc_banner_leadgen_3
Fully Managed WordPress Hosting

WordPress Theme

Divi WordPress Theme
WPZOOM

Forum Membership

Forum Membership

Reset MySQL root / user password from command line

Started by Kailash, September 13, 2008, 09:51:19 AM

Kailash

How to reset MySQL root / user password from MySQL command line:

There are several ways to reset MySQL root / user password. Below is the one of the simple way to reset it:

1) Login to mysql server, type following command at shell prompt:

$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):

mysql> use mysql;

3) For example, if you want to change the password for root user:

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='root';

4) Reload privileges:

mysql> flush privileges;
mysql> quit

Note: MySQL stores the username and password in mysql database. Hence, we have use mysql database in step 2.

Regards,

Kailash