Jump to content
xisto Community
mukund

What If You Forget Mysql Root Password

Recommended Posts

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-privileges5. 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 mysql3. Issue the following commands in the mysql client:mysql> UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root';mysql> FLUSH PRIVILEGES;4. After this, you should be able to connect using the new password.5. You can now stop mysqld and restart it normally.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.