Actions to restore env.file in Laravel

479 views Asked by At

I am new in programming. I mistakenly changed my .env file from production server into the local .env file in my Laravel project.

I created a new env file, filled the data about DB, made php artisan key:generate, started the commands: php artisan config:clear php artisan route:clear php artisan view:clear php artisan cache:clear composer dump-autoload

But the server still shows SQLSTATE[HY000] [2002] Connection refused. Maybe sommebody knows what else can I do to make the server work with the new env. Any help appreciated.

My settings changed in the new file:

APP_ENV=production APP_KEY=base64key APP_DEBUG=false APP_URL=url

LOG_CHANNEL=stack

DB_CONNECTION=mysql DB_HOST=host_name DB_PORT=3306 DB_DATABASE=db name DB_USERNAME=user name DB_PASSWORD=password name

1

There are 1 answers

0
Alisa On

I found the problem: I fixed the .env file correctly but mixed my new and old Git branches, so the wrong Git-Branch pulled onto the production server. Silly mistake!