Laravel 6 database connection error. Access denied for user

Couldn't connect to the database with laravel 6.0 SQL user and password were working fine and running smoothly on other project but the same credentials are not working on laravel 6. I have created another user and give it all permissions but still got the same error. I had cleared all kind of laravel cache, remove the bootstrap and storage cache but nothing happened. Please help me to solve this problem.

OS version: ubuntu 18.04
Server: nginx
Database: mysql 5.7.28
PHP: 7.2

my config/database.php

Upvotes: 1

Views: 624

Answers (1)

Amin Shojaei
Amin Shojaei

Reputation: 6518

Sharp(#) character recognizes as comment in .env file.

So you should put your password in double quotes("")

like this:

DB_PASSWORD="xfs#sds"

Upvotes: 1

Related Questions