[Solved] How to Update MySQL Root user Password?

| | 1 min read

Have you ever faced any issue with login in to MySQL as a root user? or Have you ever forgot the MySQL root password? You can't update your MySQL password by simply reinstalling the MySQL server.

This article helps you to reset your MySQL root password.

You can simply reset the MySQL root password by doing the following steps.

You have to stop the MySQL server first to reset the root password.

  • Stop the MySQL Server

    You can stop the MySQL server, by running the following command in your Ubuntu Terminal.

    sudo /etc/init.d/mysql stop
  • Start the mysqld configuration

    You will be able to update the mysqld configuration, by running the following command in your Ubuntu Terminal.

    sudo mysqld --skip-grant-tables &
  • Login to MySQL as Root

    Now you will be able to login as root user, by running the following command in your Ubuntu Terminal.

    mysql -u root mysql
  • Update user password.

    Update the MySQL user password, by running the following command in your Ubuntu Terminal.

    UPDATE user SET authentication_string=password('1111')
    WHERE user='root';

Hope this saved your time!