I'm using Laravel Forge to deploy a PHP site to a Ubuntu 16.04 x64 server. I deployed the site via git, and the site is up and running.
However, when I try to deploy new changes via git and Forge, I get the following error:
> php artisan optimize
Generating optimized class loader
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
I get the same [PDOException] error on my local machine at the end of the following commands:
composer install --no-interaction
php artisan clear-compiled
php artisan optimize
php artisan migrate
Here is my Laravel .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=MYPASSWORD
Here is my config/database.php file:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', 'MYPASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
When I try to connect to the remote database on Sequel Pro, I can SSH in, but then I get this error:
debug1: channel 1: new [port listener]
debug1: Local connections to LOCALHOST:53986 forwarded to remote address 188.166.19.36:3306
debug1: Local forwarding listening on ::1 port 53986.
debug1: channel 2: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 53986.
debug1: channel 3: new [port listener]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Connection to port 53985 forwarding to 127.0.0.1 port 3306 requested.
debug1: channel 4: new [direct-tcpip]
debug1: client_input_global_request: rtype [email protected] want_reply 0
channel 4: open failed: connect failed: Connection refused
debug1: channel 4: free: direct-tcpip: listening port 53985 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 53988 to 127.0.0.1 port 53985, nchannels 5
debug1: Connection to port 53986 forwarding to 188.166.19.36 port 3306 requested.
debug1: channel 4: new [direct-tcpip]
channel 4: open failed: connect failed: Connection refused
debug1: channel 4: free: direct-tcpip: listening port 53986 for 188.166.19.36 port 3306, connect from 127.0.0.1 port 53989 to 127.0.0.1 port 53986, nchannels 5
There is something going on with git and the database and Forge, but I can't figure it out.
Any help is appreciate, thanks.