Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony database password

I got a project to fix somethings and when I cant to connect in my database, i changed the .env file to:

DATABASE_URL="mysql://casino_db:[email protected]:3306/casino_ordering"

but I still have the same problem "An exception occurred in the driver:

 SQLSTATE[28000] [1045] Access denied for user 'casino_db'@'localhost' (using password: NO)"

I thing that i need to change some var in the code, may be the the APP_SECRET too? I cant find where i can change this password

like image 567
Bruno Souza Avatar asked Jul 30 '26 08:07

Bruno Souza


2 Answers

If the password has special characters, you need to url encode it. When url encoding it, you will get a lot of "%" signs that Symfony will try to parse, so you need to escape the "%" with an additional "%".

For example:

  • Original password: 1234567890$!*
  • URL encoded: 1234567890%24%21%2A
  • With % escaped: 1234567890%%24%%21%%2A

So, what goes into your .env file is 1234567890%%24%%21%%2A

like image 132
Carlos Buenosvinos Zamora Avatar answered Aug 08 '26 07:08

Carlos Buenosvinos Zamora


There are many things that can go wrong.

I suggest you starting with bin/console debug:dotenv -e <your env> to check whether the env var is set.

like image 20
Okspen Avatar answered Aug 08 '26 09:08

Okspen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!