0

enter image description here.env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=task
DB_USERNAME=root
DB_PASSWORD=******

List of all databases mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | nodeDB | | performance_schema | | phpmyadmin | | pythonDB | | sys | | task | +--------------------+ 8 rows in set (0.13 sec)

Already tried these solutions

SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES)

Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?

Shad0w
  • 27
  • 2
  • 6
  • Have you created the Database `task` ? Also please check the username and password are correct and valid. – Harish ST May 05 '20 at 18:05
  • yes, I. already create task database using cmd. – Shad0w May 05 '20 at 18:08
  • Try getting into mysql with the username and password. `mysql -u root -p` and Enter Password. Check the credentials are actually valid. – Harish ST May 05 '20 at 18:10
  • Do your password has special characters? Try changing the password with a simple one and check whether the issue is with the password. – Harish ST May 05 '20 at 18:16
  • I am using ubuntu, I can enter using "sudo mysql" but fail to enter with "mysql -u root -p" – Shad0w May 05 '20 at 18:33
  • Please check the password and username is correct. I think there may be some issues with it. – Harish ST May 06 '20 at 03:51

1 Answers1

0

If you are able to login to mysql console. Then try printing the Mysql Users by the following commands.

SELECT user,authentication_string,plugin,host FROM mysql.user;

If you find root has a plugin of type auth_socket, then either you need to change it to mysql_native_password by the following command.

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

Do not forget to replace the password with your password.

Then Flush Privileges by using FLUSH PRIVILEGES;

Alternatively, you can create another user and grant privileges.

CREATE USER 'ankush'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'ankush'@'localhost' WITH GRANT OPTION;
Harish ST
  • 1,475
  • 9
  • 23