title: Docker Compose: MySQL Syntax Error "DELIMITER" On Line 1
body: <p>I have the Problem that I want Docker Compose to directly import my Database.sql file after setting up MySQL. But it always throws me the Error: </p>
  
  <blockquote>
    <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER |' at line 1</p>
  </blockquote>
  
  <p>But somehow when I import it through phpMyAdmin in Browser it works perfectly fine. </p>
  
  <p>This is my <code>docker-compose.yml</code>:</p>
  
  <pre><code>version: "3.2"
  services:
    php:
      build: './php/'
      networks:
        - backend
      volumes:
        - ./www/:/var/www/html/
    apache:
      build: './apache/'
      depends_on:
        - php
        - mysql
      networks:
        - frontend
        - backend
      ports:
        - "8081:80"
      volumes:
        - ./www/:/var/www/html/
    mysql:
      image: mysql:5.7
      volumes:
        - ./mysql:/tmp/database
      command: mysqld --max_allowed_packet=32505856 --user=root --init-file="/tmp/database/schema.sql"
      networks:
        - backend
      environment:
        - MYSQL_ROOT_PASSWORD=root
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      links:
          - mysql
      ports:
        - '8082:80'
      environment:
        MYSQL_USERNAME: root
        MYSQL_ROOT_PASSWORD: root
        PMA_HOST: mysql
      networks:
        - backend
  networks:
    frontend:
    backend:
  </code></pre>
  
  <p>This is an Example Snippet of my .sql File which gets executed:</p>
  
  <pre><code>-- phpMyAdmin SQL Dump
  -- version 4.8.2
  -- https://www.phpmyadmin.net/
  --
  -- Host: mysql
  -- Generation Time: Aug 20, 2018 at 08:30 AM
  -- Server version: 5.7.23
  -- PHP Version: 7.2.6
  DELIMITER $$
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET AUTOCOMMIT = 0;
  START TRANSACTION;
  SET time_zone = "+00:00";
  
  --
  -- Database: `database`
  --
  CREATE DATABASE IF NOT EXISTS `databasetest` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
  USE `databasetest`;
  
  --
  -- Procedures
  --
  DROP PROCEDURE IF EXISTS `sp_filestatus_get`$$
  CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_filestatus_get` (IN `filename_name` VARCHAR(500), IN `kampagne_name` VARCHAR(100), IN `outlet_name` VARCHAR(100))  NO SQL
  
  ... Some more stuff
  
  END;
  </code></pre>
  
  <p>Did I miss something in the configuration? Or why doesnt it work with compose but directly in phpMyAdmin it works? </p>