[fix]-MySQL ERROR 1045 (28000) Access denied for user [email protected] (using password YES)

Wikitechy | 2602 Views | mysql | 01 Jun 2016

 

Scenario:

ERROR 1045(28000): Access denied for user '[email protected]' (using password: no)

Error:

MySQL ERROR 1045 (28000): Access denied for user @'localhost' (using password: YES)

Fix 1:

Login with root and then change the user password with the below command:

update user set password=PASSWORD("YOURPASSWORDHERE") where User=’[Enter the UserName here]';

Fix 2:

In Linux, the configuration files can be analyzed to find the password. In case 

  • If the password is not available or
  • The root login as well is not working.

Use the below commands to stop and re-start the server:

sudo /etc/init.d/mysql stop

Now start MySQL in safe mode to skip the privileges table as:

sudo mysqld_safe --skip-grant-tables &

Login with root:

mysql -uroot

And assign the DB that needs to be used:

use mysql;

Now all you have to do is reset your root password of the MySQL user and restart the MySQL service:

update user set password=PASSWORD(‘[Enter the password here]’) where User='root';

flush privileges;

Now quit from the database and restart MySQL server with below commands:

quit

sudo /etc/init.d/mysql stop

sudo /etc/init.d/mysql start

Now the root password should be working. Use the below command to test it:

mysql -u root -p

Fix 3:

Follow the steps below.

1. Start the MySQL server instance or daemon with the 

--skip-grant-tables option as follows.

$ mysqld --skip-grant-tables

2. Execute the below commands:

$ mysql -u root mysql

$mysql> UPDATE user SET Password=PASSWORD('Enter password here') where USER='root';

$mysql> FLUSH PRIVILEGES;

3. If the password error still occurs:

update user set authentication_string=password('Enter password here') where user='root';

4. Finally, restart the instance without the --skip-grant-tables option as:

$ /etc/init.d/mysql restart

5. Now login with the new password.

Fixes are applicable to the following versions of MySql:

1. MySQL 3.23

2. MySQL 4.0

3. MySQL 4.1

4. MySQL 5.0

5. MySQL 5.7

Related Tags:

ERROR 1045(28000): Access denied for user '[email protected]' (using password: no)

MySQL giving Error 28000, Access Denied ...(using password: YES)

Setup MySQL on Ubuntu Droplet getting error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

MySQL ERROR 1045 (28000): Access denied for user

mysql how to fix Access denied for user 'root'@'localhost'




Workshop

Bug Bounty
IOT Hackathon
Webinar

Join our Community

Advertise