How to change the root mySql password with mySql installed on Ubuntu/Linux?
|
|
|
|
|
Question: How to change the root mySql password with mySql installed on Ubuntu/Linux? Solution 1:Â - Open a new Terminal Window.Â
- Type in the commands below.
mysqladmin -u root OLDPASSWORD NEWPASSWORD - If you get the error below follow solution 2
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)' - If you did not get the error above restart the mySql server by typing the following command:
sudo service mysql restart
Solution 2:
- If Solution 1 did not work, this should work.Â
- mySql stores usernames together with their passwords in the user table in the mySql database.
- Open a new Terminal Window and type in the command below to Login to the mySql server.
- Enter your password.
- Now you need to switch to the mysql database. Type the command below
- Now we need to change the password. Type in the following command:
mysql> update user set password=PASSWORD("NEW_PASSWORD") where User='USERNAME'; Â - Flush the privileges (Reloading them) using command below:
 - Exit mySql
|