title: SQLException: Access denied when connecting to mysql in docker
body: <p>I want to deploy a springboot application into a Docker container running mysql. The application has to connect to mysql in the startup process and I am using ormlite library in order to do so. Even though the process works fine outside the container, once I try to deploy the war inside the container I get the following Exception: 
  java.sql.SQLException: Access denied for user 'root'@'localhost'. 
  MySQL is running and port 3306 is exposed in the Dockerfile.
  Below is my Dockerfile: </p>
  
  <pre><code>FROM mydocker:latest1
  MAINTAINER DockerFan version 1.0
  ADD tomcat.sh /bin/tomcat.sh
  ADD application1.war /etc/apache-tomcat-9.0.12/webapps/application1.war
  ADD application2.war /etc/apache-tomcat-9.0.12/webapps/application2.war
  EXPOSE 8080
  EXPOSE 3306
  ENTRYPOINT "/bin/tomcat.sh"  
  </code></pre>
  
  <p>while the script tomcat.sh is: </p>
  
  <pre><code>bash /etc/init.d/mysql start 
  sleep 10
  bash /etc/apache-tomcat-9.0.12/bin/catalina.sh run 
  </code></pre>
  
  <h2>EDIT</h2>
  
  <p>I've written a python script in order to check if there was something wrong with mysql but I was able to successfully connect to the database. 
  I've also tried with a simple jar that only has to connect to the db but the error is still the same. Here is the code I'm using: </p>
  
  <pre><code>String databaseURL = "jdbc:mysql://localhost/db_name?user=root&amp;amp;password=password"
  connection = new JdbcConnectionSource(databaseURL);
  </code></pre>