title: Allow remote access MySQL, Ubuntu
body: <p>Im trying to allow remote accecss to MySQL on my Ubuntu server (VPS). </p>
  
  <p>Im trying to access the database through an Java application Im building in Netbeans. Netbeans kick the following error message, when trying to connect: </p>
  
  <blockquote>
    <p>Cannot establish a connection to
    jdbc:mysql://xx.xxx.xxx.xxx:3306/xxxxxx?zeroDateTimeBehavior=convertToNull
    using com.mysql.jdbc.Driver (null, message from server: "Host
    'xx.xxx.xxx.xxx' is not allowed to connect to this MySQL server")</p>
  </blockquote>
  
  <p>I have followed this guide when trying to connect to my MySQL server through Netbeans: <a href="https://www.youtube.com/watch?v=Fk2EkBs-Oq4" rel="nofollow">https://www.youtube.com/watch?v=Fk2EkBs-Oq4</a></p>
  
  <p><strong>MySQL</strong></p>
  
  <p>MySQL running on standard port 3306.
  In /etc/mysql/my.cnf I have comment out the following row:</p>
  
  <blockquote>
    <p>bind-address = 127.0.0.1</p>
  </blockquote>
  
  <p>So no bind-address exist in my my.cnf -file. </p>
  
  <p><strong>UFW</strong></p>
  
  <p>I have UFW installed on my server. ufw status numbered looks like this:</p>
  
  <pre><code>     To                         Action      From
       --                         ------      ----
  [ 1] 22                         ALLOW IN    Anywhere
  [ 2] 80/tcp                     ALLOW IN    Anywhere
  [ 3] Anywhere                   ALLOW IN    MY-IP-ADDRESS*
  [ 4] 3306/tcp                   ALLOW IN    Anywhere
  [ 5] 3306/tcp                   ALLOW IN    MY-IP-ADDRESS*
  [ 6] 22 (v6)                    ALLOW IN    Anywhere (v6)
  [ 7] 80/tcp (v6)                ALLOW IN    Anywhere (v6)
  [ 8] 3306/tcp (v6)              ALLOW IN    Anywhere (v6)
  </code></pre>
  
  <p>*MY-IP-ADDRESS = The ip address I have "out" to the internet, which I recive from: <a href="http://whatismyipaddress.com/" rel="nofollow">http://whatismyipaddress.com/</a></p>
  
  <p>What am I doing wrong and why cant I connect?</p>
  
  <p><strong>EDIT</strong>:
  The thing is that if i bind in my.cnf I can only bind one IP. I need localhost access for my live websites running on the vps and also access from my dev-computer (which this thread is aiming). My thoughts was to remove bind in my.cnf to allow all and then grant access through my firewall UFW to localhost and my dev-computer.</p>