Authentication failed against database server at `localhost`, the provided database credentials for `root` are not valid

Getting an authentication failed error in the terminal even though my username and password are correct.

For Example, My user name is “root” and password is “mypassword” below is the database url for this


When I use this in my .env file and call it in the prisma schema file i’m getting the below error.

“Authentication failed against database server at localhost, the provided database credentials for root are not valid.”

But, I was able to create a db and test my connection using mysql in terminal, also using “Mysql ace” application.

I’m able to connect to my db.

Not sure why its not working inside the next.js project.

Please help

I had a previous version of mysql installed which might have been interfering. Try uninstalling the old and current version and reinstall the latest one. Run mysql configurator after the installation completes and then set a new password. Use that password in your DATABASE_URL env variable and try running npx prisma migrate dev in your course project terminal. It should work. Let me know if it doesn’t work, will try and help you out

1 Like