php - Can't connect to MySQL on live with Laravel 5 -
i have problem on connecting laravel 5 mysql on live server, seems ok on localhost when uploaded live server, wont connect saying:
pdoexception in connector.php line 47: sqlstate[hy000] [2003] can't connect mysql server on '10.0.0.131' (111)
here config
local server:
config/database.php
'mysql' => [ 'driver' => 'mysql', 'host' => env('db_host', '127.0.0.1'), 'database' => env('db_database', 'my_database_name'), 'username' => env('db_username', 'my_username'), 'password' => env('db_password', 'my_password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, ],
.env
app_env=local app_debug=true app_key=0jxknppt1pvvx0sfdmpxfveqe5c24hlp db_host=127.0.0.1 db_database=my_database_name db_username=my_username db_password=my_password cache_driver=file session_driver=file
live server:
config/database.php
'mysql' => [ 'driver' => 'mysql', 'host' => env('db_host', '10.0.0.131'), 'database' => env('db_database', 'my_database_name'), 'username' => env('db_username', 'my_username'), 'password' => env('db_password', 'my_password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, ],
.env
app_env=local app_debug=true app_key=0jxknppt1pvvx0sfdmpxfveqe5c24hlp db_host=10.0.0.131 db_database=my_database_name db_username=my_username db_password=my_password cache_driver=file session_driver=file
it doesn't seem configuration error, assuming did want connect 10.0.0.131
, did not change default listening port. because client tries connect database specified, can't due connection refused error, tells there underlying tcp problem.
possible cases are:
- service not running
- service not listening on external connections
- firewall blocking connections
- network issues
you should try log in remote server and, there, connect database via shell command verify can.
Comments
Post a Comment