Installing MySQL 5.7

mysql

#1

I made a script to install MySQL 5.7 on CircleCI container. Simply run

curl -sSL https://s3.amazonaws.com/circle-downloads/install-mysql5.7-circleci.sh | sh

How to change MySQL/MariaDB version
MySQL JSON Datatype support
#2

Thanks for this @kimh. Where do you recommend we put this in our circle.yml file?


#3

I think the script froze:


#4

Sorry about that! It looks like this issue is happening because DEBIAN_FRONTEND isn’t set to noninteractive in our builds. In order to make sure that this script runs correctly you would need to change the curl command to

export DEBIAN_FRONTEND=noninteractive && curl -sSL https://s3.amazonaws.com/circle-downloads/install-mysql5.7-circleci.sh | sh

#5

Thanks. Still failed


#6

That looks intermittent network issue with apt. Can you try again?


#7

I tried it again and it worked. Thank you! It would be much nicer to put it in circle.yml such as:

machine:
  mysql:
    version: 5.7.12

But this does work, so much appreciated.


#8

The script is missing the step to upgrade database/data to 5.7 using mysql_upgrade command.


#9

Instead of the script you can use docker and the official mysql images.
Available versions: https://hub.docker.com/_/mysql/

machine:
  services:
    - docker
  pre:
    # Stop the preinstalled MySQL 5.6
    - sudo service mysql stop
dependencies:
  pre:
    # Start MySQL 5.7.11 within a docker container
    - docker info
    - >
      docker run
      --detach
      --name mysql
      --publish 3306:3306
      --env MYSQL_ALLOW_EMPTY_PASSWORD='yes'
      --env MYSQL_DATABASE=circle_test
      --env MYSQL_USER=ubuntu
      --env MYSQL_PASSWORD=p455w0rd
      mysql:5.7.11
      ; sleep 10

#10

@kimh this started failing today for me, getting these errors:

W: Failed to fetch http ://repo.mysql.com/apt/ubuntu/dists/precise/Release Unable to find expected entry ‘mysql-5.7-dmr/source/Sources’ in Release file (Wrong sources.list entry or malformed file)

E: Some index files failed to download. They have been ignored, or old ones used instead.

export DEBIAN_FRONTEND=noninteractive && curl -sSL https://s3.amazonaws.com/circle-downloads/install-mysql5.7-circleci.sh | sh returned exit code 100

Action failed: export DEBIAN_FRONTEND=noninteractive && curl -sSL https://s3.amazonaws.com/circle-downloads/install-mysql5.7-circleci.sh | sh


#11

I can confirm I am getting the exact same error. It just started today.


#12

I tihnk the problem is that script is trying to add mysql-5.7-dmr instead of just mysql-5.7. Now that 5.7 is GA, dmr release is no longer there.


#13

That was the issue. I copied the script and made the change and everything works.


#14

Thanks for letting us know about this. We’ve now updated the script so it should work again as expected.


#15

I forked kimh’s script and created new one.

I also wrote this on my blog.


#16

I believe this script upgrades from the mysql already installed on Circle’s base image, so I added an apt-get remove first, to ensure a fresh install. Upgrading can have side effects (https://stackoverflow.com/questions/31967527/table-performance-schema-session-variables-doesnt-exist).


#17