title: Can’t connect to mysql docker image
body: <p>I have issue using mysql/mysql-server docker image.
  I want to connect to mysql server, create db, user with all PRIVILEGES to have ability to create new schema and run liquibase in future.</p>
  
  <p>I run container like this:</p>
  
  <pre><code>sudo docker run --name db -e MYSQL_ROOT_PASSWORD=qwe123 -e MYSQL_DATABASE=test \
    -d -p 3306:3306 mysql/mysql-server:5.6 --lower-case-table-names=1
  </code></pre>
  
  <p>when I do <code>docker ps</code> I see that it's running but when I'm trying to run liquibase (using root/qwe123) it failed with:</p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (default-cli) on project db: null,  message from server: "Host '172.17.0.1' is not allowed to connect to this MySQL server" -> [Help 1]</p>
  </blockquote>
  
  <p>tried with user:</p>
  
  <pre><code>sudo docker run --name db -e MYSQL_ROOT_PASSWORD=qwe123 -e MYSQL_DATABASE=test \
    -e MYSQL_USER=admin -e MYSQL_PASSWORD=qwe123 -d -p 3306:3306 \
    mysql/mysql-server:5.6 --lower_case_table_names=1
  </code></pre>
  
  <p>with admin user have error creating new schema, it looks like admin has only access to test database:</p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (default-cli) on project db: Access denied for user 'admin'@'%' to database 'test2' -> [Help 1]</p>
  </blockquote>
  
  <p>with root the following error:</p>
  
  <blockquote>
    <p>[ERROR] The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.</p>
  </blockquote>
  
  <p>Also tried to set privileges for admin in init command:</p>
  
  <pre><code>docker run --name db -e MYSQL_ROOT_PASSWORD=qwe123 -e MYSQL_DATABASE=test -d \
    -p 3306:3306 mysql/mysql-server:5.6 --lower_case_table_names=1 \
   '--init-connect=CREATE USER `admin`@`localhost` IDENTIFIED BY "qwe123"; GRANT ALL PRIVILEGES ON *.* TO `admin`@`localhost` WITH GRANT OPTION; CREATE USER `admin`@`%` IDENTIFIED BY "qwe123";GRANT ALL PRIVILEGES ON *.* TO `admin`@`%` WITH GRANT OPTION;FLUSH PRIVILEGES;'
  </code></pre>
  
  <p>In this case for root user have error:</p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (default-cli) on project db: null,  message from server: "Host '172.17.0.1' is not allowed to connect to this MySQL server" -> [Help 1]</p>
  </blockquote>
  
  <p>for admin -  the following:</p>
  
  <blockquote>
    <p>12:13:57 [ERROR] The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.</p>
  </blockquote>
  
  <p>Also tried to use localhost and 127.0.0.1 as host to DB, always have error with connection.
  Any ideas?</p>