ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

Solved: Login to new mysql server by following command:

$ sudo mysql

MariaDB [(none)]> use mysql;

MariaDB [mysql]> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘password’;

MariaDB [mysql]> FLUSH PRIVILEGES;
MariaDB [mysql]> EXIT;

Now you can login with the following command:

$ mysql -u root -p

Enjoy.

Leave a Reply

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