Change Default Password for MySQL
tip
The following is an example with the root password of
tC9S86SFWxga
.Be sure to change the password for root in the actual configuration.
Advance data backup is recommended before operation.
Change the default password for MySQL with the mingdaoyun-community container started.
docker exec -i $(docker ps | grep community | awk '{print $1}') bash -c 'mysql -uroot -p123456 -h127.0.0.1' <<< "GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'tC9S86SFWxga';"
Modify the file docker-compose.yaml to add environment variables and port mapping.
The default path for file docker-compose.yaml: /data/mingdao/script/docker-compose.yaml
Add a new environment variable
ENV_MYSQL_PASSWORD
to specify the new password for mysql.ENV_MYSQL_PASSWORD: "tC9S86SFWxga"
Add port mapping to map port 3306 out of the container (you can leave port mapping off if don't need external access).
- 3306:3306
Configuration example of file docker-compose.yaml
version: '3'
services:
app:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community:5.3.1
environment:
ENV_ADDRESS_MAIN: "https://hap.domain.com"
ENV_APP_VERSION: "5.3.1"
ENV_API_TOKEN: "******"
ENV_MYSQL_PASSWORD: "tC9S86SFWxga" # Add
ports:
- 8880:8880
- 3306:3306 # Add
volumes:
- ./volume/data/:/data/
- ../data:/data/mingdao/data
Restart the microservice in the directory of Install Manager to take effect.
bash service.sh restartall