MySQL ERROR 1698 (28000): Access denied for user 'root'@'localhost' (Solution)
To fix the the error "ERROR 1698 (28000): Access denied for user 'root'@'localhost'", change the root MySQL user authentication method from
Let's go through the steps of how to do this on a server.
Login to the
mysql server in
sudo mode as the root user and supply any required passwords.
sudo mysql -u root -p
mysql console run the following commands to set the root MySQL user to use
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql server to ensure the new changes are applied:
sudo service mysql restart
You can now login to MySQl as root user without having to use sudo mode like this:
mysql -u root -p
This also means you should have no issues connecting to mysql remotely using a database client with a regular user over SSH.