After upgrading MySQL from the previous version to 5.7, when I had tried to log in to the database as a non-sudo user it shows the following error. But I was enabled to login into the system as sudo user without any issues.
ERROR 1698 (28000): Access denied for user ‘root’@’localhost’. You can use the following steps to beat MySQL Error 1698 (28000): Access denied for user ‘root’ @ ‘localhost’
In Ubuntu systems running MySQL 5.7 (and later), the root user is authenticated by the auth_socket plugin by default.
$ sudo mysql #No Username to be the provide mysql> USE mysql; mysql> SELECT User, Host, plugin FROM mysql.user;
+——————+———————–+ | User | plugin | +——————+———————–+ | root | authsocket | | mysql.sys | mysqlnativepassword | | debian-sys-maint | mysqlnativepassword | +——————+———————–+ mysql> UPDATE user SET plugin=’mysqlnative_password’ WHERE User=’root’; mysql> FLUSH PRIVILEGES; mysql> exit; $ service mysql restart
If you want to login to your MySQL server as root from an external program such as phpMyAdmin you have two options. The first one is to change the authentication method from authsocket to mysqlnativepassword. You can do that by running the following command: ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysqlnativepassword BY ‘verystrong_password’; FLUSH PRIVILEGES;
Conclusion: Now you have learned to install troubleshoot the Access Denied error in MySql 5.7 and also you know how to use it with PHPMyAdmin.
No comments, yet...