BashSQLMySQLdatabase administration

Reset Mysql Root Password

  1. stop the mysqld daemon

    sudo systemctl stop mysql.service # it depends on your distro
  2. start mysql server skipping grant tables

    mysqld_safe --skip-grant-tables &
  3. start mysql client

    sudo mysql
  4. run the following sql commands

    UPDATE mysql.user SET Password=PASSWORD('NEW-PASSWORD') WHERE User='root';
    FLUSH PRIVILEGES;

Tutorial from official docs