I have a private pipeline where this pipeline using mysql 5.7 works properly, but once I change it to use mysql 8 it fails with
<span>ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)</span>
The config file that works:
image: mysql:5.7
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'test_db'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'test_user'
MYSQL_PASSWORD: 'test_password'
pipelines:
default:
- step:
script:
- mysql --version
- mysql -h 127.0.0.1 -u test_user --password=test_password -D test_db --execute="SHOW DATABASES"
- mysql -h 127.0.0.1 -u test_user --password=test_password -D test_db --execute="SHOW VARIABLES"
services:
- mysql
The config file that fails with the above error message:
image: mysql:8
definitions:
services:
mysql:
image: mysql:8
environment:
MYSQL_DATABASE: 'test_db'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'test_user'
MYSQL_PASSWORD: 'test_password'
pipelines:
default:
- step:
script:
- mysql --version
- mysql -h 127.0.0.1 -u test_user --password=test_password -D test_db --execute="SHOW DATABASES"
- mysql -h 127.0.0.1 -u test_user --password=test_password -D test_db --execute="SHOW VARIABLES"
services:
- mysql
The only difference is the version number of mysql (in two places)
ps. I've created this only as a minimal example of what I see. I am actually trying to use the mysql service from an image that contains my code. I get the same error there and I think if this is solved then my own code will be able to connect to the mysql server as well.
ps2. I know mysql 8 changed the authentication protocol. I started down this rabbit hole when I started to get this error: "failed: 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:", but I expect(ed) that if both the client and the server are mysql 8 then it would work.