How to change MySQL/MariaDB version

As per documentation, the default mysql version on CircleCI is 5.5.41.
I’m currently using MySQL statements (INET6_ATON) that require MySQL version 5.6 and above.

On top of that, our production environment is running 10.0.21-MariaDB-1~wheezy.

In circle.yml, it is easy to choose the PHP or Node versions. You just add

  php:
    version: 5.5.21

  node:
    version: 4.1.0

…But currently CircleCI does not support defining the MySQL version this way.
So 2 questions:

  • How to specify the MySQL version in CircleCI ?
  • How to change the database from MySQL to MariaDB ?

Thanks


Update:
What I’ve already tried:

Error installing MySQL 5.6
This is not working, getting the following error:
sudo apt-get update; sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server-5.6 returned exit code 100

Installing MySQL 5.7
I was able to install MySQL 5.7 using the command below. This way my tests run fine again. yay.

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


However I am still interested in hearing how I can easily pick ANY MySQL version, or how I can use the MariaDB database architecture

1 Like

In the FAQ we suggest installing MySQL 5.6 like this:

dependencies:
  pre:
    - sudo apt-add-repository -y 'deb
      http://ppa.launchpad.net/ondrej/mysql-experimental/ubuntu precise
      main'
    - sudo apt-get update; sudo DEBIAN_FRONTEND=noninteractive apt-get
      install -y mysql-server-5.6

There is no easy way to pick the MySQL version right now, but we’ll see what we can do about that in the future.

2 Likes

I am also experiencing issues with this. Specifically, I need to install 5.6.28.

This is what our circle.yml looks like for instaling MariaDB 5.5. It took us some time to set this up correctly, so hopefully this helps. You should be able to adapt for your specific version of MariaDB

dependencies:
  pre:
    - sudo apt-get install python-software-properties
    - sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
    - sudo add-apt-repository -y 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main'
    - sudo apt-get update
    - sudo apt-get purge mysql* mariadb*
    - sudo DEBIAN_FRONTEND=noninteractive aptitude install -y mariadb-server
    - sudo apt-get install libmariadbclient-dev
1 Like