title: Gitlab CI: Persist MySQL data between stages
body: <p>How do I persist MySQL data between different build stages?</p>
  
  <p>I have MySQL set up as a service however, when going from a build to a deploy stage the MySQL database is empty and I'm unable to find any information on this.</p>
  
  <p>Example <code>gitlab-ci.yml</code>:</p>
  
  <pre><code>image: php:latest
  services:
    - mysql:5.6
  stages:
    - build
    - deploy
  
  build:
    stage: build
    script:
      - [INSERT MYSQL DATA]
    allow_failure: false
    artifacts:
      when: on_success
      paths:
        - /var/lib/mysql/
  deploy:
    stage: deploy
    script:
      - [MYSQL DUMP]
    dependencies:
      - build
    allow_failure: false
    when: on_success
  </code></pre>
  
  <p>The MySQL dump would be empty despite successfully inserting the data at the build stage.</p>