title: Unable to start Mysql in a Dockerfile when executing CMD script
body: <p>I'm unable to start mysql demon when executing <code>mysqld</code> in a bash script at the end of my Dockerfile width <code>CMD [ "./myscript.sh" ]</code>. However,  <code>CMD [ "mysqld" ]</code> works.</p>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM mysql:5.7
  USER mysql
  COPY ./setconf.sh .
  COPY config/my.cnf /etc/mysql/conf.d
  CMD [ "./setconf.sh" ]
  
  # CMD ["mysqld"]
  # This command works ! 
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <pre><code>[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to         create it
  [ERROR] Fatal error: Can't open and lock privilege tables: Table     'mysql.user' doesn't exist
  </code></pre>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>  mysql:
      build: mysql
      environment:
        MYSQL_PASSWORD: pass
        MYSQL_ROOT_PASSWORD: pass
        HOST: mysql
        MYSQL_ROOT_HOST: mysql
      ports:
           - "3306:3306"
  </code></pre>
  
  <p><strong>./setconf.sh</strong></p>
  
  <pre><code>mysqld
  </code></pre>
  
  <p>Note: </p>
  
  <ul>
  <li>I'm doing <code>docker-compose down</code> at every try</li>
  <li>I need special options to run mysql</li>
  </ul>
  
  <p><strong>my.cnf</strong></p>
  
  <pre><code>[mysqld]
  default-storage-engine = INNODB
  sql-mode = "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
  transaction-isolation = READ-COMMITTED
  innodb_flush_log_at_trx_commit = 1
  init_connect = "set session autocommit=0"
  log_bin_trust_function_creators = 1
  max_sp_recursion_depth = 100
  lower_case_table_names = 1
  thread_stack = 256K
  max_allowed_packet = 16M
  </code></pre>
  
  <p><a href="https://gist.github.com/TimDorand/8de9cede571cbe2c02e9164765b1c0bb" rel="nofollow noreferrer">Check the Detailled docker-compose logs</a></p>