I've tried deploying by updating the .env with the database credentials on the database server
The .env file on your web server should contain all the proper credentials for connecting to your DB server.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I just created a server and site on Forge, and now I'm trying to deploy from GitHub and I keep receiving the following error.
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO)
Script php artisan optimize handling the post-install-cmd event returned with error code 1
I did not install a database on this server because I'm using a separate database server. I've tried deploying by updating the .env with the database credentials on the database server but it doesn't work; no matter what I do I receive that error message.
Do I need to have a database on this new server even though I'm not going to use it?
Edit: I have installed a database on this server, named it forge and added the user forge and it's still giving me the same problem.
I figured it out; I actually had to hard code the database password in config/database.php and then deploy from Github on a clean site. Doesn't seem that's the right way to do it but it was the only way I could get it to work.
Please or to participate in this conversation.