Posts Tagged ‘reset’

reset mysql root password on linux(ubuntu)

March 7th, 2011
  1. Stop the MySQL Server.
    sudo /etc/init.d/mysql stop

    If you can not stop the Mysql Server normally due to some problems, try this command to list all mysql processes and then kill them one by one.

    ps aux | grep mysql
  2. Start the Mysql without checking password.
    sudo mysqld --skip-grant-tables &
  3. Login to MySQL as root.
    mysql -u root mysql
  4. Set your new password.
    UPDATE user SET Password=PASSWORD('NEWPASSWORD') WHERE User='root';
    FLUSH PRIVILEGES;

    The more secure way is:

    SET PASSWORD FOR 'root'@'%' = PASSWORD('NEWPASSWORD');
    FLUSH PRIVILEGES;