title: Remote DB Error: connect ECONNREFUSED (node-mysql/UBuntu/VirtualBox)
body: <p>I have two separate Ubuntu VMs running on VirtualBox. I am getting the error "Remote DB Error: connect ECONNREFUSED". Here is some background information:</p>
  
  <ol>
  <li>When co-located on same VM, NodeJS to MySQL works fine together. Problem only started after moving MySQL to its own VM.</li>
  <li>VMs set up in VirtualBox as Internal Network. They have their own static IPs, and the two VMs can ping each other's IP addresses fine.</li>
  <li>When I first got the error, the indication was that nodeJS was trying connection on port 3306 ("Error: connect ECONNREFUSED 192.168.1.69:3306"). Then, I added the port option when creating the connection object ("port : '3306'), but this did not fix problem.</li>
  <li><p>Next, I saw a thread that suggested checking to see what port mySQL is listening on by running (netstat -ln | grep mysql), and the result I got back was "unix  2      [ ACC ]     STREAM     LISTENING     1831     /var/run/mysqld/mysqld.sock". So, since it said it was listening on 1831, I switched my port in the connection creation code to below:</p>
  
  <pre><code>qvar connection = mysql.createConnection({
  host     : '192.168.1.69',
  port     : '1831',
  user     : 'root',
  password : 'vinson',
  database : 'pilot',
  stringifyObjects: 'true'
  });
  </code></pre></li>
  </ol>
  
  <p>, however, I was still getting the same error.</p>
  
  <p>UPDATE TO MY POST:</p>
  
  <p>Since my first posting of this... eh.. post, I have learned some things, and in the process made some incremental progress:</p>
  
  <ol>
  <li>By default, MySQL only listens to localhost traffic. In order to have it listen to external traffic you have to disable the listen/bind address in it's my.cnf file. So, I did that, and then restarted MySQL.</li>
  <li>Once I did that, I ran "netstat -tlnp", a new line dsiplayed indicating something (definitely MySQL) listening on 0.0.0.0:3306, and this was not there before I made the config change and restarted MySQL.</li>
  <li>Then, I executed a query again from the NodeJS VM, and I got a different error (hey, I'll take this as a sign of incremental progress):
  
  <blockquote>
    <p>" Error: Cannot enqueue Query after fatal error."</p>
  </blockquote></li>
  </ol>
  
  <p>So that is where I am now. As before, I would be grateful for any ideas as to what I might try next. Thanks for any help!</p>