If none of the other answers work for you, and you received this error:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
1 Stop Your Server First
$ sudo service mysql stop
2 Make MySQL service directory.
$ sudo mkdir /var/run/mysqld
3 Give MySQL permission to work with the created directory.
$ sudo chown mysql: /var/run/mysqld
4 Start MySQL, without permission and network checking.
$ sudo mysqld_safe --skip-grant-tables --skip-networking &
5 Log in to your server without any password.
$ mysql -u root mysql
or
$ sudo mysql -u root mysql
THANKS 😃
Top comments (0)