Reset MySQL root password

Here are the steps to reset the MySQL root password from the server command line:

Log in to the server via  command line as 'root' user and run the following commands:

  1. Stop the currently running MySQL process:

    #/etc/init.d/mysql stop
  2. Now start the MySQL process with the –skip-grant-tables option so that it will not prompt for the password:

    #mysqld_safe --skip-grant-tables &
  3. Once done, log in as root user without password using the following command:

    #mysql -u root
  4. Once logged in, set a new root password:

    #mysql> use mysql;
    #mysql> update user set password=PASSWORD("NEW PASSWORD") where User='root';
    #flush privileges;

    Need to replace "NEW PASSWORD" with the new password.
  5. Exit from MySQL and then restart the service:

    #service mysql stop
    #service mysql start
  6. Try to login using the new password:

    #mysql -u root -p'NEW-PASSWORD'


  • mysql root, reset mysql root password
  • 0 utilizatori au considerat informația utilă
Răspunsul a fost util?

Articole similare

How To Install and Use Docker on Ubuntu 16.04

Introduction Docker is an application that makes it simple and easy to run application processes...

Change Main IP of the server :: Vesta Panel

If we are changing the main IP of a server installed with Vesta panel, we can use the following...

cPanel: Apache-FastCGI Data Timeout Error

If you are using a cPanel server and have FastCGI enabled in Apache, you might be facing the...

Domainkey installer in cPanel

You can use the following cPanel script to install domainkey for an account...

Email issues :: Common Troubleshooting Steps

Here I will discuss some common errors and their solution: We are using a mail relay setup for...