How to fix ERROR 1698 (28000): Access denied for user ‘root’@’localhost’ on ubuntu 18.04 Server

This error happen when you install MySql on Ubuntu 18.04 and try to connect with root account with command mysql -u root -p

 How to fix ERROR 1698 (28000): Access denied for user ‘root’@’localhost’ on ubuntu 18.04 Server
How to fix ERROR 1698 (28000): Access denied for user ‘root’@’localhost’ on ubuntu 18.04 Server

that not error, it happen when you install MySql in new version of Ubuntu 18.04 1) you NEED to run this command:

sudo mysql

2) next command

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourPassword';

change YourPassword with your mysql pass

3) next command

FLUSH PRIVILEGES;

4) exit mysql with command

EXIT

Now you can log in with

mysql -u root -p



Have a nice day…




Leave a Reply

Your email address will not be published. Required fields are marked *