There are different ways to change the password of MySQL account. They are:
- Changing password using UPDATE statement:
For this you need to go to the User table of mysql database. To change password you need to execute the following commands:
USE mysql;
UPDATE user
SET password = PASSWORD('your_password')
WHERE user = 'username' AND
host = 'hostname';
FLUSH PRIVILEGES;
For example:
UPDATE user
SET password = PASSWORD('your_password')
WHERE user = 'root' AND
host = 'localhost';
- Changing password using set password:
SET PASSWORD FOR 'username'@'hostname' = PASSWORD('your_password')
- Changing password using GRANT USAGE statement:
Following statement is used to change the mysql account password :
GRANT USAGE ON *.* TO username@hostname IDENTIFIED BY your_password
0 Comment(s)