Set / Change / Reset the MySQL root password in KUBUNTU or UBUNTU

Do you want to change the MySQL root user’s password? Okay, here I will be telling you the exact steps to change it right away! MySQL server generate has by using PASSWORD(‘YOUR_PASSWORD’); so you can do it also manually if you wanna change your root password. If so then open user table from mysql database and update the password column with your own password with encrypting by password().

1. Stop the MySQL Server.

sudo /etc/init.d/mysql stop

2. Start the mysqld configuration.

sudo mysqld --skip-grant-tables &

3. Login to MySQL as root.

mysql -u root mysql

4. Replace YOURNEWPASSWORD with your new password!

UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;

5. Now it's the time to restart your MySQL server :)  now run this command from konsole/terminal
sudo /etc/init.d/mysql start

6. What next? Umm... well, you are done :P 
  1. Thanks for the post.
    But I guess you made mistake in the step 5. May be the command should be
    sudo /etc/init.d/mysql start

  2. @Arafat Rahman

    Thanks for pointing out. it’s changed to sudo /etc/init.d/mysql start

    Thanks for stopping by

  3. dcleaner says:

    thanks mate :)
    most straight forward solution i found.

line
footer
Powered by Wordpress | Designed by Elegant Themes