Changing root user password in mysql
Changing root user password in mysql
Resetting root password on window
1. Log in to the window using admin credentials
2. Check if ur mysql server is running, if so stop it. To stop mysql server go to
Start Menu -> Control Panel -> Administrative Tools -> Services
Go to MYSQL and stop it.
3. Save the following commands in a file. lets call it mysql-password-reset.txt and save this file to c drive.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
4.Start MYSQL using mysqld-nt with file option.
The mysqld-nt.exe process is used within the mySQL Database server application to handle SQL requests and provide general access to the database.
5. C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqld-nt –init-file=C:\mysql-password-reset.txt
6. MYSQL server will start successfully.
7. Stop the server and delete the file and start the MYSQL server in normal mode.
8. To start server in normal mode go to services and start the MYSQL service.
Resetting root password on unix system
1. Stop mysql server if running.
$ /etc/init.d/mysql stop
2. Now start MYSQL using following command.
$ mysqld_safe --skip-grant-tables &
3. Now log into mysql server using
$ mysql -u root
4. You will see mysql command line. Now you can reset your new root password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
5. Stop mysql server
$ /etc/init.d/mysql stop
6. Your new password is set. You can use new passowrd to log in to mysql.
References
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
Related Post
Comments
Leave a Reply