Error installing MySQL 5.6

The builds installing MySQL 5.6 from the ondrej/mysql-5.6 PPA on Launchpad have recently started failing, as the PPA doesn’t contain the track for our container OS (Ubuntu 12.04LTS Precise) anymore.

The ondrej/mysql-experimental PPA still contains the mysql-5.6 package for Precise, so you can change the add-apt-repository command in your circle.yml to the following to make the builds work again:

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
2 Likes

Hi @alexey

The PPA install method using this repository isn’t active any longer, so this method doesn’t work.

Do you have an official update on how to do it?

Currently I’ve used the instructions in this post in a bash script: http://ronaldbradford.com/blog/updating-mysql-on-ubuntu-12-04-lts-to-mysql-5-6-2015-04-02/

Cheers,
Robbie

I used the steps here: https://gist.github.com/mahemoff/54b31e272421472d4fb6

dependencies:
  pre:
    # installing mysql 5.6 (5.5 is installed by default)
    - >
      export DEBIAN_FRONTEND=noninteractive
      && sudo apt-get -y remove mysql-server && sudo apt-get -y autoremove
      && sudo apt-get -y install software-properties-common
      && sudo apt-add-repository -y 'deb http://ppa.launchpad.net/ondrej/mysql-experimental/ubuntu precise main'
      && sudo apt-get update
      && sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password ""'
      && sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password ""'
      && sudo apt-get -y install mysql-server

Is this still the way to do this? Do you have plans to support this “natively”?

The CircleCI 14.04 ‘Trusty’ image now has MySQL 5.7 preinstalled. You can change the build image via the menu in Project settings > Build environment.

Hi,
The line documented to downgrade to 5.6 is failing. Is the documetation outdated ?
https://circleci.com/docs/faq/#how-do-i-use-mysql-56

$ sudo apt-get update; sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server-5.6

 * MySQL Community Server 5.7.13 is stopped
Removing mysql-client (5.7.13-1ubuntu14.04) ...
Removing mysql-community-client (5.7.13-1ubuntu14.04) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Selecting previously unselected package libdbi-perl.
(Reading database ... 308815 files and directories currently installed.)
Preparing to unpack .../libdbi-perl_1.630-1_amd64.deb ...
Unpacking libdbi-perl (1.630-1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1) ...
Selecting previously unselected package mysql-client-core-5.6.
Preparing to unpack .../mysql-client-core-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-client-5.6.
Preparing to unpack .../mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.6 (5.6.30-0ubuntu0.14.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/mysql_config_editor', which is also in package libmysqlclient-dev 5.7.13-1ubuntu14.04
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package mysql-server-core-5.6.
Preparing to unpack .../mysql-server-core-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Replaced by files in installed package mysql-common (5.7.13-1ubuntu14.04) ...
Selecting previously unselected package mysql-server-5.6.
Preparing to unpack .../mysql-server-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
 * MySQL Community Server 5.6.30-0ubuntu0.14.04.1 is already stopped
Unpacking mysql-server-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Replaced by files in installed package mysql-common (5.7.13-1ubuntu14.04) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-1_all.deb ...
Unpacking libhtml-template-perl (2.95-1) ...
Selecting previously unselected package mysql-common-5.6.
Preparing to unpack .../mysql-common-5.6_5.6.30-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt-get update; sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server-5.6 returned exit code 100

Action failed: sudo apt-get update; sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server-5.6
1 Like

To downgrade from MySQL 5.7 to 5.6 on 14.04 you can add the following to circle.yml:

dependencies:
  pre:
    - >
      sudo DEBIAN_FRONTEND=noninteractive apt-get remove --yes --purge mysql* &&
      sudo apt-get autoremove &&
      sudo apt-get autoclean &&
      sudo rm -rf /var/lib/mysql &&
      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
    - echo "CREATE USER '${CIRCLECI_USER}'@'localhost'" | mysql -u root
    - echo "GRANT ALL PRIVILEGES ON *.* TO '${CIRCLECI_USER}'@'localhost' WITH GRANT OPTION" | mysql -u root
    - echo "CREATE USER 'circle'@'localhost'" | mysql -u root
    - echo "GRANT ALL PRIVILEGES ON *.* TO 'circle'@'localhost' WITH GRANT OPTION" | mysql -u root
    - echo "FLUSH PRIVILEGES" | mysql -u root
    - echo "CREATE DATABASE circle_test" | mysql -u root

You may also wish to set environment variables:

machine:
  environment:
    MYSQL_HOST: localhost
    MYSQL_USER: ubuntu
    MYSQL_PASSWORD: ''
    MYSQL_CONNECTION_LIMIT: 30
    MYSQL_PORT: 3306
1 Like

I tried with or without the env var (with MYSQL_USER: root or MYSQL_USER: ubuntu) et I’m stuck to :

** Invoke db:create:all (first_time) ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:create:all Access denied for user 'ubuntu'@'localhost' (using password: NO).

Can you try prefixing sudo to the command you’re using to connect to MySQL with.

I had the same issue after downgrading. It looks like the MySQL username “root” with no password works. I just updated all my CI database configs to use that. We’ll see how this build goes, but it at least appears to be connecting to the DB now.

2 Likes

Running bundler with sudo leads to a lot of access issues.
sudo bundle exec rake db:create:all db:schema:load --trace Your Ruby version is 1.9.3, but your Gemfile specified 2.2.4

1 Like

Thanks for the feedback. My suggestion to use sudo above is not helpful if you’re invoking MySQL via another tool.

Sorry for any confusion with this. We’re working on an update out to resolve the issue.

We’re also experience the same issue. Was this issue not foreseen before upgrading the MySQL versions from 5.6 to 5.7?? I feel as if a solid solution must’ve been thought of before the upgrade because now we can’t get any of our builds and deployment to work!

Same here. Build has been down for many hours now. Tried following several ideas but none have worked.

#fail

Apologies for the breaking change. This was unexpected.

We’ve just rolled out an update to the 14.04 image so builds that ran successfully with 5.6 should now run without changes on 5.7 (unless you are using MySQL features subject to breaking changes from MySQL 5.6 to 5.7).

So our recommendation is to run with the preinstalled 5.7 and only revert to 5.6 if your database is incompatible with 5.7.

@tom - Does this mean that if we require mysql-server-5.6, we are still stuck with the Access denied for user 'ubuntu'@'localhost' (using password: NO). problem?

Is there a solution from CircleCI to successfully run mysql-server-5.6 package? That was the whole point. The builds started breaking against a previously documented and supported approach to 5.6 installation.

@tom Could you provide us with a clear solution to using MySQL 5.6? I’m also having the same issue as @sainejob

**Access denied for user ‘ubuntu’@‘localhost’ (using password: NO). **
Please provide the root password for your mysql installation

How can we change the user ubuntu or inject the root password (which I believe is a blank string?). This has been a very frustrating experience because it has completely blocked our builds/deployment and we’re currently forced to completely bypass CircleCI because of this issue and the lack of solution provided by CircleCI…

1 Like

I’ve updated my post above to include steps to create the relevant users and databases if you’re downgrading to MySQL 5.6.

@tom - Thanks! That fixes it. I tried to go down this path but didn’t quite have enough information regarding the CircleCI MySQL setup. You should also update the CircleCI FAQ regarding mysql-server-5.6 (here: https://circleci.com/docs/faq/#how-do-i-use-mysql-56) so that others will get the update. This page comes up pretty high in Google when searching for answers on this topic.

@tom I’m using the Ubuntu 14.04 build image and didn’t need to use the PPA, there’s mysql-server-5.6 in the regular packages for Ubuntu 14.04, for the rest, this solved my issue!