Forgotten Mysql root password


  1. sudo service mysql stop
  2. sudo mysqld_safe --skip-grant-tables   (You may need to ^c or ^z to return to CLI)
  3. sudo service mysql start
  4. sudo mysql -u root
  5. use mysql;
  6. show tables;
  7. describe user;
  8. update user set authentication_string=password('1111') where user='root'; (on some versions use Password instead of authentication_string)

login with password 1111

Was this answer helpful?

 Print this Article

Also Read

Centos 7 & MariaDB database name bug

There is a know bug in MariaDB with databases containing _ in the name.If you need to grant...