- image: circleci/node:latest
However this is producing a new error:
#!/bin/bash -eo pipefail
sudo apt-get install mysql-client
mysql -h 127.0.0.1 -u user -ppassw0rd test_db < ~/app-backend/server/src/tools/sql/tables.sql
Reading package lists… 1%
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl
libdbi-perl libjemalloc1 libreadline5 libterm-readkey-perl
mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
The following NEW packages will be installed:
default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl
libdbi-perl libjemalloc1 libreadline5 libterm-readkey-perl
mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mysql-client
0 upgraded, 12 newly installed, 0 to remove and 22 not upgraded.
Need to get 12.3 MB of archives.
After this operation, 75.4 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main amd64 mariadb-common all 10.1.41-0+deb9u1 [28.5 kB]
Get:2 http://deb.debian.org/debian stretch/main amd64 libaio1 amd64 0.3.110-3 [9412 B]
Get:3 http://deb.debian.org/debian stretch/main amd64 libreadline5 amd64 5.2+dfsg-3+b1 [119 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 mariadb-client-core-10.1 amd64 10.1.41-0+deb9u1 [5132 kB]
6% [4 mariadb-client-core-10.1 37.0 kB/5132 kB 1%]Get:5 http://deb.debian.org/debian stretch/main amd64 libconfig-inifiles-perl all 2.94-1 [53.4 kB]
Get:6 http://deb.debian.org/debian stretch/main amd64 libjemalloc1 amd64 3.6.0-9.1 [89.8 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 mariadb-client-10.1 amd64 10.1.41-0+deb9u1 [5930 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 default-mysql-client all 1.0.2 [3050 B]
Get:9 http://deb.debian.org/debian stretch/main amd64 libdbi-perl amd64 1.636-1+b1 [766 kB]
Get:10 http://deb.debian.org/debian stretch/main amd64 libdbd-mysql-perl amd64 4.041-2 [114 kB]
Get:11 http://deb.debian.org/debian stretch/main amd64 libterm-readkey-perl amd64 2.37-1 [27.2 kB]
Get:12 http://deb.debian.org/debian stretch/main amd64 mysql-client amd64 5.5.9999+default [1698 B]
Fetched 12.3 MB in 0s (89.5 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package mariadb-common.
(Reading database … 33184 files and directories currently installed.)
Preparing to unpack …/00-mariadb-common_10.1.41-0+deb9u1_all.deb …
Unpacking mariadb-common (10.1.41-0+deb9u1) …
Selecting previously unselected package libaio1:amd64.
Preparing to unpack …/01-libaio1_0.3.110-3_amd64.deb …
Unpacking libaio1:amd64 (0.3.110-3) …
Selecting previously unselected package libreadline5:amd64.
Preparing to unpack …/02-libreadline5_5.2+dfsg-3+b1_amd64.deb …
Unpacking libreadline5:amd64 (5.2+dfsg-3+b1) …
Selecting previously unselected package mariadb-client-core-10.1.
Preparing to unpack …/03-mariadb-client-core-10.1_10.1.41-0+deb9u1_amd64.deb …
Unpacking mariadb-client-core-10.1 (10.1.41-0+deb9u1) …
Selecting previously unselected package libconfig-inifiles-perl.
Preparing to unpack …/04-libconfig-inifiles-perl_2.94-1_all.deb …
Unpacking libconfig-inifiles-perl (2.94-1) …
Selecting previously unselected package libjemalloc1.
Preparing to unpack …/05-libjemalloc1_3.6.0-9.1_amd64.deb …
Unpacking libjemalloc1 (3.6.0-9.1) …
Selecting previously unselected package mariadb-client-10.1.
Preparing to unpack …/06-mariadb-client-10.1_10.1.41-0+deb9u1_amd64.deb …
Unpacking mariadb-client-10.1 (10.1.41-0+deb9u1) …
Selecting previously unselected package default-mysql-client.
Preparing to unpack …/07-default-mysql-client_1.0.2_all.deb …
Unpacking default-mysql-client (1.0.2) …
Selecting previously unselected package libdbi-perl.
Preparing to unpack …/08-libdbi-perl_1.636-1+b1_amd64.deb …
Unpacking libdbi-perl (1.636-1+b1) …
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack …/09-libdbd-mysql-perl_4.041-2_amd64.deb …
Unpacking libdbd-mysql-perl (4.041-2) …
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack …/10-libterm-readkey-perl_2.37-1_amd64.deb …
Unpacking libterm-readkey-perl (2.37-1) …
Selecting previously unselected package mysql-client.
Preparing to unpack …/11-mysql-client_5.5.9999+default_amd64.deb …
Unpacking mysql-client (5.5.9999+default) …
Setting up mariadb-common (10.1.41-0+deb9u1) …
update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up libconfig-inifiles-perl (2.94-1) …
Setting up libjemalloc1 (3.6.0-9.1) …
Setting up libterm-readkey-perl (2.37-1) …
Processing triggers for libc-bin (2.24-11+deb9u4) …
Setting up libaio1:amd64 (0.3.110-3) …
Setting up libreadline5:amd64 (5.2+dfsg-3+b1) …
Setting up libdbi-perl (1.636-1+b1) …
Setting up mariadb-client-core-10.1 (10.1.41-0+deb9u1) …
Setting up libdbd-mysql-perl (4.041-2) …
Setting up mariadb-client-10.1 (10.1.41-0+deb9u1) …
Setting up default-mysql-client (1.0.2) …
Setting up mysql-client (5.5.9999+default) …
Processing triggers for libc-bin (2.24-11+deb9u4) …
ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password’ cannot be loaded: /usr/lib/x86_64-linux-gnu/mariadb18/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
Exited with code 1
Okay, so not much of a fix… luckily I’m not require to use mysql version 8 over 5.7, so I was able to change my mysql image to 5.7 in order to get around this error.
From what I found on forums and stack overflow, it looks like CircleCI have rebuilt the docker images and it’s broken something in the pipeline. There is a plugin for sha-2 caching for mysql 8+ and this seems to be the issue.
For someone having this issue but require mysql version 8, I also saw that you can use a command to revert back to native passwords like so:
- image: circleci/mysql:latest
just add this:
command: [–default-authentication-plugin=mysql_native_password]
environment:
MYSQL_DATABASE: myapp_test
On an offshoot that I’ve had an issue with since CircleCI have updated is that once you change your nodejs version, if you’re running any modules that are built to specific versionf of node (bcrypt.js) then you will also have to remove the npm install cache in order to re-built the whole node package
Hi megmut,
This was an unintended change on our end when we applied an update to the image. I’m rolling back our change now to investigate.
Sorry about the inconvenience.
That’s alright, I’ve managed to get all the builds running my end, though I did have to use mysql 5 which isn’t ideal but it’s okay for now.
Thanks for the quick response!
@megmut Your config in your first post is hard to read because of formatting so it’s a bit hard for me to follow along with the issue.
@jmillerarvig Can you post the error exactly? A build URL (if public) and/or config will be helpful as well.
Without knowing this issue specifically, this might be related to Debian 10 “Buster” switching to MariaDB as the default instead of MySQL. Our images are based on the official Docker images, and little by little upstream has been updating their images to be based on Debian 10 instead of Debian 9 “Stretch”.
With the primary container, you can use the package mariadb-client
instead of mysql-client
in Debian 10. They work the exact same way, just a different name.
Here’s the configuration that originally worked but is now broken (I apologize if the formatting isn’t quite right, I’m new to this forum).
# PHP CircleCI 2.0 configuration file
# Check https://circleci.com/docs/2.0/language-php/ for more details
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/php:7.2.18
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mysql:9.4
# set some environment variables, mainly for database access. Note that APP_KEY is already configured in circle's web UI
environment:
- APP_NAME: "Laravel"
- APP_ENV: "local"
- APP_DEBUG: "true"
- APP_LOG_LEVEL: "debug"
- DB_CONNECTION: mysql
- DB_HOST: 127.0.0.1
- DB_PORT: 3306
- DB_DATABASE: laravel
- DB_USERNAME: root
- DB_PASSWORD: root
- AWE_HOST: 127.0.0.1
- AWE_PORT: 3306
- AWE_DATABASE: awe
- AWE_USERNAME: root
- AWE_PASSWORD: root
#- APP_URL: "https://view.arvig.com"
# this starts a separate docker thingy
- image: circleci/mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD: root
- MYSQL_DATABASE: laravel
# i just left this as-is from wherever i copied it
working_directory: ~/repo
steps:
# gets code from git
- checkout
# makes sure PDO is installed for Laravel's SQL queries
- run:
name: Install PHP extensions
command: sudo apt-get install libxml2-dev default-mysql-client && sudo -E docker-php-ext-install pdo_mysql bcmath soap
# from https://hackernoon.com/ci-cd-pipeline-using-github-docker-circleci-heroku-ef7f8a90a6f9
# this makes sure the separate mysql docker is up and running before we do SQL stuff
- run:
name: Wait for MySQL
command: dockerize -wait tcp://localhost:3306 -timeout 1m
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
#create awe database
- run: mysql -h 127.0.0.1 -u root -proot -e "create database awe"
# install composer stuff
- run: composer install -n --prefer-dist
# this runs all the existing migrations (including stuff from php artisan make:auth) and inserts data from /var/www/laravel/database/seeds/DatabaseSeeder.php
- run: php artisan migrate:refresh --seed
- run: php artisan db:seed --class=AcamLocationSeeder
- run: php artisan db:seed --class=TestingUsersTableSeeder
- save_cache:
paths:
- ./vendor
key: v1-dependencies-{{ checksum "composer.json" }}
# run tests!
- run: php ./vendor/phpunit/phpunit/phpunit --debug
Error we get:
#!/bin/bash -eo pipefail
sudo apt-get install libxml2-dev default-mysql-client && sudo -E docker-php-ext-install pdo_mysql bcmath soap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1
libreadline5 libterm-readkey-perl mariadb-client-10.1
mariadb-client-core-10.1 mariadb-common
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
The following NEW packages will be installed:
default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl
libdbi-perl libjemalloc1 libreadline5 libterm-readkey-perl libxml2-dev
mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common
0 upgraded, 12 newly installed, 0 to remove and 1 not upgraded.
Need to get 13.0 MB of archives.
After this operation, 78.8 MB of additional disk space will be used.
Err:1 http://deb.debian.org/debian stretch/main amd64 mariadb-common all 10.1.38-0+deb9u1
404 Not Found
Get:2 http://deb.debian.org/debian stretch/main amd64 libaio1 amd64 0.3.110-3 [9412 B]
Get:3 http://deb.debian.org/debian stretch/main amd64 libreadline5 amd64 5.2+dfsg-3+b1 [119 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 mariadb-client-core-10.1 amd64 10.1.38-0+deb9u1 [5107 kB]
Get:5 http://deb.debian.org/debian stretch/main amd64 libconfig-inifiles-perl all 2.94-1 [53.4 kB]
Get:6 http://deb.debian.org/debian stretch/main amd64 libjemalloc1 amd64 3.6.0-9.1 [89.8 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 mariadb-client-10.1 amd64 10.1.38-0+deb9u1 [5918 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 default-mysql-client all 1.0.2 [3050 B]
Get:9 http://deb.debian.org/debian stretch/main amd64 libdbi-perl amd64 1.636-1+b1 [766 kB]
Get:10 http://deb.debian.org/debian stretch/main amd64 libdbd-mysql-perl amd64 4.041-2 [114 kB]
Get:11 http://deb.debian.org/debian stretch/main amd64 libterm-readkey-perl amd64 2.37-1 [27.2 kB]
Get:12 http://deb.debian.org/debian stretch/main amd64 libxml2-dev amd64 2.9.4+dfsg1-2.2+deb9u2 [812 kB]
Fetched 13.0 MB in 0s (48.8 MB/s)
E: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.1/mariadb-common_10.1.38-0+deb9u1_all.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Exited with code 100
We also tried some tweaks, including mariadb-client. Here is a config with that:
# PHP CircleCI 2.0 configuration file
# Check https://circleci.com/docs/2.0/language-php/ for more details
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/php:7.2.18
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mysql:9.4
# set some environment variables, mainly for database access. Note that APP_KEY is already configured in circle's web UI
environment:
- APP_NAME: "Laravel"
- APP_ENV: "local"
- APP_DEBUG: "true"
- APP_LOG_LEVEL: "debug"
- DB_CONNECTION: mysql
- DB_HOST: 127.0.0.1
- DB_PORT: 3306
- DB_DATABASE: laravel
- DB_USERNAME: root
- DB_PASSWORD: root
- AWE_HOST: 127.0.0.1
- AWE_PORT: 3306
- AWE_DATABASE: awe
- AWE_USERNAME: root
- AWE_PASSWORD: root
#- APP_URL: "https://view.arvig.com"
# this starts a separate docker thingy
- image: circleci/mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD: root
- MYSQL_DATABASE: laravel
# i just left this as-is from wherever i copied it
working_directory: ~/repo
steps:
# gets code from git
- checkout
# makes sure PDO is installed for Laravel's SQL queries
- run:
name: Install PHP extensions
command: sudo apt-get install libxml2-dev mariadb-client && sudo -E docker-php-ext-install pdo_mysql bcmath soap
# from https://hackernoon.com/ci-cd-pipeline-using-github-docker-circleci-heroku-ef7f8a90a6f9
# this makes sure the separate mysql docker is up and running before we do SQL stuff
- run:
name: Wait for MySQL
command: dockerize -wait tcp://localhost:3306 -timeout 1m
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
#create awe database
- run: mysql -h 127.0.0.1 -u root -proot -e "create database awe"
# install composer stuff
- run: composer install -n --prefer-dist
# this runs all the existing migrations (including stuff from php artisan make:auth) and inserts data from /var/www/laravel/database/seeds/DatabaseSeeder.php
- run: php artisan migrate:refresh --seed
- run: php artisan db:seed --class=AcamLocationSeeder
- run: php artisan db:seed --class=TestingUsersTableSeeder
- save_cache:
paths:
- ./vendor
key: v1-dependencies-{{ checksum "composer.json" }}
# run tests!
- run: php ./vendor/phpunit/phpunit/phpunit --debug
And here is the error from that config:
sudo apt-get install libxml2-dev mariadb-client && sudo -E docker-php-ext-install pdo_mysql bcmath soap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1
libreadline5 libterm-readkey-perl mariadb-client-10.1
mariadb-client-core-10.1 mariadb-common
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
The following NEW packages will be installed:
libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1
libreadline5 libterm-readkey-perl libxml2-dev mariadb-client
mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common
0 upgraded, 12 newly installed, 0 to remove and 1 not upgraded.
Need to get 13.1 MB of archives.
After this operation, 78.9 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main amd64 libaio1 amd64 0.3.110-3 [9412 B]
Get:2 http://deb.debian.org/debian stretch/main amd64 libdbi-perl amd64 1.636-1+b1 [766 kB]
Get:3 http://deb.debian.org/debian stretch/main amd64 libdbd-mysql-perl amd64 4.041-2 [114 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 libreadline5 amd64 5.2+dfsg-3+b1 [119 kB]
Get:5 http://deb.debian.org/debian stretch/main amd64 libterm-readkey-perl amd64 2.37-1 [27.2 kB]
Get:6 http://deb.debian.org/debian stretch/main amd64 libxml2-dev amd64 2.9.4+dfsg1-2.2+deb9u2 [812 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 mariadb-common all 10.1.38-0+deb9u1 [28.4 kB]
Err:8 http://deb.debian.org/debian stretch/main amd64 mariadb-client-core-10.1 amd64 10.1.38-0+deb9u1
404 Not Found
Get:9 http://deb.debian.org/debian stretch/main amd64 libconfig-inifiles-perl all 2.94-1 [53.4 kB]
Get:10 http://deb.debian.org/debian stretch/main amd64 libjemalloc1 amd64 3.6.0-9.1 [89.8 kB]
Get:11 http://deb.debian.org/debian stretch/main amd64 mariadb-client-10.1 amd64 10.1.38-0+deb9u1 [5918 kB]
Err:12 http://deb.debian.org/debian stretch/main amd64 mariadb-client all 10.1.38-0+deb9u1
404 Not Found
Fetched 7938 kB in 0s (31.2 MB/s)
E: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.1/mariadb-client-core-10.1_10.1.38-0+deb9u1_amd64.deb 404 Not Found
E: Failed to fetch http://deb.debian.org/debian/pool/main/m/mariadb-10.1/mariadb-client_10.1.38-0+deb9u1_all.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Exited with code 100
jmillerarvig:
sudo apt-get install libxml2-dev default-mysql-client && sudo -E docker-php-ext-install pdo_mysql bcmath soap
Thanks for that. The above line is the issue. apt-get update
needs to be run first since the Apt package index is out of date. Also, I’d suggest switching default-mysql-client
to mariadb-client
since that’s the package that gets installed anyway. Cut out the middle man. Here’s what the line should look like:
sudo apt-get update && sudo apt-get install libxml2-dev mariadb-client && sudo -E docker-php-ext-install pdo_mysql bcmath soap