Enter password for user root: Error: Access denied for user 'root'@'localhost' code example
Example: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
sudo service mysql stop
sudo mkdir /var/run/mysqld
sudo chown mysql: /var/run/mysqld
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root mysql
UPDATE mysql.user SET authentication_string=PASSWORD('YourNewPasswordBuddy'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost';
FLUSH PRIVILEGES;
EXIT;
sudo service mysql restart
mysql -u root -p