Reputation: 27
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?
Upvotes: 0
Views: 4720
Reputation: 1503
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;
Upvotes: 0