RSA public key is not available client side (option serverRsaPublicKeyFile not set)
JohnnysMartins opened this issue · comments
Johnnys Martins commented
I tried to follow the Official documentation example to run a docker-compose version having a MySQL and flyway image running the migration but an error about RSA public key is been showed
docker-compose.yml example:
version: '3'
services:
flyway:
image: flyway/flyway
command: -url=jdbc:mysql://db -schemas=myschema -user=root -password=P@ssw0rd -connectRetries=60 migrate
volumes:
- .:/flyway/sql
depends_on:
- db
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=P@ssw0rd
command: ["--default-authentication-plugin=mysql_native_password"]
ports:
- 3306:3306
Frank van Boven commented
Found this on StackOverflow: https://stackoverflow.com/questions/72385060/how-to-connect-to-dockerized-mysql-database-with-flyway
But after that I get the following error:
flyway-1 | WARNING: Connection error: Could not connect to address=(host=db)(port=3306)(type=master) : Socket fail to connect to host:db, port:3306. db
flyway-1 | (Caused by db)
Jochem commented
I have solved this issue by changing the command of the flyway container from:
command: -url=jdbc:mysql://db -schemas=myschema -user=root -password=P@ssw0rd -connectRetries=60 migrate
to:
command: -url=jdbc:mysql://db?allowPublicKeyRetrieval=true -schemas=myschema -user=root -password=P@ssw0rd -connectRetries=60 migrate
More info here, esp. regarding the security of this (fine for running local containers): metabase/metabase#12545 (comment)