Laravel5设置数据库端口?
我的数据库端口8889
DB_HOST=127.0.0.1
DB_PORT=8889
terminal报错:
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
网页报错
PDOException in Connector.php line 47: SQLSTATE[HY000] [2002] Connection refused
in Connector.php line 47
at PDO->__construct('mysql:host=127.0.0.1;dbname=insist', 'root', 'root', array('0', '2', '0', false, '0')) in Connector.php line 47
at Connector->createConnection('mysql:host=127.0.0.1;dbname=insist', array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, '0')) in MySqlConnector.php line 20
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 10791
at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 10787
at ConnectionFactory->make(array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false), 'mysql') in compiled.php line 10705
at DatabaseManager->makeConnection('mysql') in compiled.php line 10660
DB_HOST=127.0.0.1
DB_PORT=8889
terminal报错:
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
网页报错
PDOException in Connector.php line 47: SQLSTATE[HY000] [2002] Connection refused
in Connector.php line 47
at PDO->__construct('mysql:host=127.0.0.1;dbname=insist', 'root', 'root', array('0', '2', '0', false, '0')) in Connector.php line 47
at Connector->createConnection('mysql:host=127.0.0.1;dbname=insist', array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, '0')) in MySqlConnector.php line 20
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 10791
at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in compiled.php line 10787
at ConnectionFactory->make(array('driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'insist', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false), 'mysql') in compiled.php line 10705
at DatabaseManager->makeConnection('mysql') in compiled.php line 10660
3 个回复
popo7to
赞同来自:
'port' => env('DB_PORT', 'localhost'),
丫hoo
赞同来自:
丫hoo
赞同来自: