Reset MySQL root password Stampa

  • mysql root, reset mysql root password
  • 0

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'

 


Hai trovato utile questa risposta?

« Indietro