I've just started using Laravel Forge, but I can't seem to login to MySQL after SSHing into the server. Each time I try:
mysql -uforge -p
Enter password: thepassword
I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I've got my environment variables set using Forge, so it shouldn't be using the defaults:
DB_HOST=thehostip
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=theotherpassword
and I've left the database configuration as:
'default' => env('DB_CONNECTION', 'mysql'),
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
...
],
Okay, the solution turned out to be that using 512MB server is just inadequate. After emailing Laravel Forge and explaining my issue it was suggested that updating to at least a 1GB server would solve the problem, and it did. Once I provisioned a 1GB server I could get into MySQL via SSH with no issues.