title: MySQL: [08S01] Communications link failure
body: <p>I have an application with local DB, which is H2. But customer is using MySQL. There were some issues on customer side, so I decided to install and run an application against MySQL on local machine (MacOS). I am using java 9.</p>
  
  <ol>
  <li><a href="https://dev.mysql.com/downloads/file/?id=475582" rel="nofollow noreferrer">Download MySQL</a></li>
  <li>Install</li>
  <li><a href="https://www.jetbrains.com/help/idea/connecting-to-a-database.html" rel="nofollow noreferrer">Follow very easy how to from jetbrains</a></li>
  </ol>
  
  <p>Current setup:
  <a href="https://i.stack.imgur.com/Mu4Vc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mu4Vc.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/MlQQE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MlQQE.png" alt="enter image description here"></a></p>
  
  <p>After click on "Test Connection" I am getting following error.</p>
  
  <p><a href="https://i.stack.imgur.com/vcDVt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vcDVt.png" alt="enter image description here"></a></p>
  
  <p>There is a lot of comments:</p>
  
  <p><a href="https://stackoverflow.com/questions/16459990/sql-error-0-sqlstate-08s01-communications-link-failure">packet drops or badly configured Firewall/Switch</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6480573/jdbc-error08s01-sometimes-happens">a lot of transaction</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11714042/openshift-mysql-communications-link-failure">known bug - solution in maven dependency</a></p>
  
  <p>But most of them are not in test connection, but in configuration. Also the connection for those guys works at least once or through another set of firewalls. None of the previous solutions fit my case.</p>
  
  <p>I also try to restart MySQL with:</p>
  
  <pre><code>sudo service mysql restart
  </code></pre>
  
  <p>With the result:</p>
  
  <pre><code>service: command not found
  </code></pre>
  
  <p>Or just to check the status with:</p>
  
  <pre><code>sudo service mysql status
  </code></pre>
  
  <p>With the result: </p>
  
  <pre><code>service: command not found
  </code></pre>
  
  <p>I dont know if it is connected to my issue? Is db running "forever" or idea will run it only when I will run the app? Could anyone help with connection to db?</p>