Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vininjr/375241442bf3ccd8761a51280d23438f to your computer and use it in GitHub Desktop.
Save vininjr/375241442bf3ccd8761a51280d23438f to your computer and use it in GitHub Desktop.
Error 1628: Acess denied for user 'root'@'localhost' (Install mysql)
# ERROR 1698 (28000): Access denied for user 'root'@'localhost', change password mysql.
$ sudo mysql -u root # I had to use "sudo" since is new installation
mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;
+------------------+-----------------------+
| User | plugin |
+------------------+-----------------------+
| root | auth_socket |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ service mysql restart
$ sudo mysql -u root # I had to use "sudo" since is new installation
mysql> USE mysql;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ service mysql restart
##
@vininjr
Copy link
Author

vininjr commented Feb 15, 2021

root pass: *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B

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