Hiho
Spring Settings
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url= jdbc:mysql://vetdb:3306/vetdb?useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
spring.datasource.password=root
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.platform=mysql
spring.datasource.initialize=true
spring.jpa.show-sql=false
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jmx.default-domain=TierarztDatenController
endpoints.jmx.uniquie-names=true
Docker Compose
vetdb:
container_name: vetdb
hostname: vetdb
image: mariadb
restart: always
command: --default-authentication-plugin=mysql_native_password --innodb-flush-method=O_DSYNC --innodb-use-native-aio=0 --log_bin=ON
environment:
MYSQL_ROOT_PASSWORD: ${VET_DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${VET_DB_NAME}
MYSQL_PASSWORD: ${VET_DB_PASSWORD}
MYSQL_ROOT_HOST: '%'
volumes:
# - "${VET_DB_PATH}/mysql-conf:/etc/mysql/conf.d"
- "${VET_DB_PATH}:/var/lib/mysql"
- "${VET_DB_PATH}/mysql-log:/var/log/mysql"
.env
VET_DB_PATH=./dockervolumes/microservices/VET/db
VET_DB_NAME=vetdb
VET_DB_ROOT_PASSWORD=root
VET_DB_PASSWORD=root
Exception: `java.sql.SQLException: null, message from server: "Host '172.23.0.9' is not allowed to connect to this MariaDB server"`
i added MYSQL_ROOT_HOST: '%' to allow everyone to connect to the db but it didnt work
i tried to use a config-file.cnf containing bind-address = 0.0.0.0 but it didnt work
funny thing is everything worked well before i restarted the container today and i didnt change this service in 3 days
i tried see if name/password = root work
$ docker exec -it vetdb bash
root@vetdb:/# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
but root without password works (inside the container)
root@vetdb:/# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 21
Server version: 10.3.9-MariaDB-1:10.3.9+maria~bionic-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
if i just remove spring.datasource.password=root
or set it to spring.datasource.password=
then it results in the same exception
what am i doing wrong?