Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ianeds200's avatar

Git deployment

I created a new Ubuntu server with Forge (deployment via git) and my site is working. BUT when I try to deploy new updates via git, it stalls out here:

> php artisan optimize
Generating optimized class loader

                                             
  [PDOException]                             
  SQLSTATE[HY000] [2002] Connection refused  

I have the .env correct, the correct password for the database, I am using DB_HOST=127.0.0.1, and the site is loading properly. I just can't make any updates via git.

Does anyone have any insight into why this is happening? Thank you in advance.

NOTE: I can't connect to my database via Sequel Pro either...

0 likes
2 replies
richard@gorbutt.com's avatar

Was the user added to MYSQL? Try the forge user with the db password sent when you created the server.

Only thought I have!

ianeds200's avatar

Thanks for the reply. I think the database is working, because I now see that my changes are being deployed. It's just at the end of the deployment I get the above error. I am going to trying asking this in the main forum.

Please or to participate in this conversation.