Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save codedeep79/fb7141f65dfd02ff851b0a39e8caff39 to your computer and use it in GitHub Desktop.

Select an option

Save codedeep79/fb7141f65dfd02ff851b0a39e8caff39 to your computer and use it in GitHub Desktop.
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

When i try access MySQL: mysql -u root -p -h 127.0.0.1 -P 3306, then i get error:ERROR 1698 (28000): Access denied for user 'root'@'localhost'

Solution:

sudo mysql -u root # I had to use "sudo" since it was a new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;

sudo service mysql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment