Jump to content

Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

What If You Forget Mysql Root Password

2 replies to this topic

#1 mukund


    Member [Level 2]

  • Kontributors
  • PipPipPipPipPip
  • 78 posts

Posted 14 March 2005 - 08:31 AM

If you have set a root password, but forgot what it was, you can set a new password with the following procedure:
1. Take down the mysqld server by sending a kill (not kill-9) to the mysqld server. The pid is stored in a `.pid' file, which is normally in the MySQL database directory:
shell> kill `cat /mysql-data-directory/hostname.pid`
You must be either the Unix root user or the same user mysqld runs as to do this.

2. Restart mysqld with the --skip-grant-tables option.

3. Set a new password with the mysqladmin password command:
shell> mysqladmin -u root password 'mynewpassword'

4. Now you can either stop mysqld and restart it normally, or just load the privilege tables with:
shell> mysqladmin -h hostname flush-privileges

5. After this, you should be able to connect using the new password.

Alternatively, you can set the new password using the mysql client:

1. Take down and restart mysqld with the --skip-grant-tables option as described above.

2. Connect to the mysqld server with:
shell> mysql -u root mysql

3. Issue the following commands in the mysql client:
mysql> UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root';

4. After this, you should be able to connect using the new password.

5. You can now stop mysqld and restart it normally.
  • 0

#2 odomike



  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,095 posts
  • Gender:Male
  • Location:Nigeria
  • Interests:Website designing, Graphics designing, Computer Softwares, networking, computer games (RPGs), Education, making friends.

Posted 14 March 2005 - 07:47 PM

Kool tutorial m8. Hey do you have much knowledge about MYSQL servers? I just installed MYSQL V5.01 in my system but I dont know exactly what to do.

Plz help.
  • 0

#3 kuberan_swe


    Member [Level 2]

  • Kontributors
  • PipPipPipPipPip
  • 87 posts

Posted 31 August 2007 - 12:49 PM

the default password for mySQL is empty. if you forget your root password. it would be enough if you just reinstall the mySQL and login using null password.
  • 0

Reply to this topic


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users