Reputation: 83
I am trying to change the password for the mysql Database configuration in the docker-compose.yml for the root super user. I seem to always have it working with 'rootpw' value. I would rather do this:
export MYSQLPASS=mypass
and then change the docker-compose.yml file
mysql:
image: repo.mitchell.com/mariadb:10.2
environment:
MYSQL_DATABASE: dataflow
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: $MYSQL_PASS
and also change it here:
dataflow-server:
image: repo.mitchell.com/springcloud/spring-cloud-dataflow-server-local:1.6.3.RELEASE
container_name: dataflow-server
ports:
- "9393:9393"
- "9900:9900"
environment:
- spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.kafka.binder.brokers=kafka:9092
- spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.kafka.binder.zkNodes=zookeeper:2181
- spring_datasource_url=jdbc:mysql://mysql:3306/dataflow
- spring_datasource_username=root
- spring_datasource_password=$MYSQL_PASS
But it does not seem to work this way. It is true that the first time I launched docker-compose up, the mysqlpass was rootpw. It is only in the next iteration I am trying to parameterize the password, but my hunch is that maybe mysql already has the password set by then for root user. I WILL give it a try on a brand new VM [env]
Upvotes: 0
Views: 259
Reputation: 83
Actually, my guess was right. So here is what I tried I wiped the directory(db-data) that is mounted on my host with mysql docker container ie
/home/cloud-user/springdataflow/db-data:/var/lib/mysqlcode
What I am trying to do is that I am trying to start afresh the database. Next I exported the variable $MYSQL_PASS=mysecret or whatever you may choose to.
In summary the root user account password cannot be changed once set just by parameterizing the password after the fact, it needs to be done one time in the beginning. Which makes sense
Upvotes: 1