Web Hosting Forum - A Web Hosting community for Webmasters


Divi WordPress Theme

Author Topic: Reset MySQL root / user password from command line  (Read 5686 times)

0 Members and 1 Guest are viewing this topic.

Offline Kailash

  • Administrator
  • Web Hosting Master
  • *****
  • Posts: 601
  • iTrader: +153/-0
    • View Profile
Reset MySQL root / user password from command line
« on: September 13, 2008, 09:51:19 AM »
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

Divi WordPress Theme
Tags:
 

Related Topics

  Subject / Started by Replies Last post
2 Replies
17367 Views
Last post November 22, 2011, 10:03:24 PM
by Mrtu92
0 Replies
3819 Views
Last post August 12, 2007, 06:30:11 PM
by Kailash
0 Replies
2808 Views
Last post August 29, 2007, 02:28:13 AM
by Tech
3 Replies
4705 Views
Last post March 31, 2011, 12:25:17 PM
by yours
0 Replies
812 Views
Last post March 20, 2015, 11:07:23 PM
by Kailash