我正在尝试从本地计算机连接Cakephp 3.x远程数据库服务器。
但显示错误
错误:SQLSTATE [HY000] [2002]无主机路由
app.php中的本地数据库配置如下所示 -
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => '192.168.1.19',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
'port' => '3306',
'username' => 'remote_db_user',
'password' => 'my_password',
'database' => '********',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
],
/*Other configs*/
]
关于远程服务器:
ping 192.168.1.19可以从我的电脑上获取此IP
此IP地址没有名称服务器
如何解决此问题?