When i had been working with nginx, i got the issue "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)" when i execute the following command:
$ mysql -u root
Error 1045 (28000): Access denied
for
user
'root'
@
'localhost'
(using password: YES)
To Fix the issue, i performed the bellow command:
1. Stop mysqld deamons.
$
sudo
service mysql stop
2. Go to mysql/bin directory
$
cd
/usr/bin
3. Start mysql deamons with option.
$
sudo
mysqld_safe --skip-grant-tables
4.
Open another terminal and open a mysql session to execute this:
$ mysql
mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD(
'YOUR_NEW_PASSWORD_HERE'
) WHERE user =
'root'
;
mysql>
exit
;
5. Now kill the mysqld_safe process and restart mysqld normally:
$
sudo
service mysql start
That's it. Now you can access the mysql console :)