Recover from lost root password
Set root password, enable root user for socket and http access
Section titled “Set root password, enable root user for socket and http access”Solves problem of: access denied for user root using password YES Stop mySQL:
sudo systemctl stop mysqlRestart mySQL, skipping grant tables:
sudo mysqld_safe --skip-grant-tablesLogin:
mysql -u rootIn SQL shell, look if users exist:
select User, password,plugin FROM mysql.user ;Update the users (plugin null enables for all plugins):
update mysql.user set password=PASSWORD('mypassword'), plugin = NULL WHERE User = 'root';exit;In Unix shell stop mySQL without grant tables, then restart with grant tables:
sudo service mysql stopsudo service mysql start