0

我有两个虚拟机在流浪。

我的应用程序位于 [web] VM (192.168.10.10) 上。我的数据库在 [db] VM (192.168.10.11) 上。

我将我的应用程序部署到 [web] VM,然后从 [web] VM 中运行我的迁移,以便它迁移到 [db] VM。

本质上,我想从一个 VM 迁移到另一个 (192.168.10.10 > 192.168.10.11)

我更改了我的 database.php 文件,使其具有正确的 IP,并且我三次检查了我的 [db] VM 以确保凭据匹配:

return array(
    'connections' => array(

        'mysql' => array(
            'driver'    => 'mysql',
            'host'      => '192.168.10.11',
            'database'  => 'demo',
            'username'  => 'demo',
            'password'  => 'demo',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),

        'auth' => array(
            'driver'    => 'mysql',
            'host'      => '192.168.10.11',
            'database'  => 'demo',
            'username'  => 'demo',
            'password'  => 'demo',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),
    ),
);

当我从我的 [web] VM 运行“php artisan migrate”时,它会出错:

[PDOException]                             
SQLSTATE[HY000] [2002] Connection refused  

migrate [--bench[="..."]] [--database[="..."]] [--force] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

知道拒绝连接发生了什么吗?

谢谢!

4

0 回答 0