0

I have two VMs in vagrant.

My app is on the [web] VM (192.168.10.10). My db is on the [db] VM (192.168.10.11).

I deployed my app to the [web] VM and then from within the [web] VM, I want to run my migrations so it migrates to the [db] VM.

Essentially, I want to migrate from one VM to another (192.168.10.10 > 192.168.10.11)

I changed my database.php file so it has the right IP and I triple checked my [db] VM to make sure that the credentials match:

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'    => '',
        ),
    ),
);

When I run "php artisan migrate" from my [web] VM it errors out:

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

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

Any idea what is happening to refuse the connection?

Thanks!

jasonaburton
  • 2,941
  • 7
  • 34
  • 48
  • are you using a multi machine Vagrantfile ? can you ping 192.168.10.11 from 192.168.10.10 ? if so you need to check `/etc/mysql/my.cnf`and comment the `bind-address` line or assign the value `0.0.0.0` – Frederic Henri Jan 15 '16 at 20:16
  • It is a multi-machine vagrantfile, and I can ping 192.168.10.11 from 192.168.10.10. I tried your fix and it didn't work. I'm getting a Connection Timed Out error (even without your fix) – jasonaburton Jan 19 '16 at 19:35

0 Answers0