Reputation: 280
I've installed mysql npm in my adonis project and also set DB_CONNECTION=mysql in .env.
Everything in my .env is correct, but when i run the migration cmd i get an error.
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlMessage: "Access denied for user 'root'@'172.17.0.1' (using password: YES)",
sqlState: '28000',
fatal: true
I don't have any clue whats going on, i google the error but no solution was found.
And why its saying 'root'@'172.17.0.1' if localhost is 127.0.0.1?
What should i do?
Upvotes: 0
Views: 365
Reputation: 61
As the error message implies, you're having an authorization problem.
You said that your .env file is correct, but double check if it contains the following variables:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1 //make sure it's your localhost
DB_PORT= //usually 3306
DB_USER=
DB_PASSWORD=
DB_DATABASE=
Then, check if your config/database.js
file is properly calling the .env variables, without any typo or missmatched name.
If it is all fine and the problem continues, he i suggest you to check your database credentials.
Try acessing it without password, since some default configurations to mysql databases uses the username root
and an empty password. (in the error message you received a (using password: YES)
)
If you double checked all that and are still getting this error, I recommend you to create another Database User with root privileges.
Upvotes: 4