docker run --name=mysql57 \
--mount type=bind,src=/data/mysql/data,dst=/var/lib/mysql \
-p 3306:3306 \
-d mysql/mysql-server:5.7
docker logs mysql57 2>&1 | grep GENERATED
docker exec -it mysql57 mysql -uroot -p
mysql> ALTER USER 'root'@'*' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
[root@k8s-node1 mysql]# docker ps |grep mysql57|awk '{print$1}'
ec989f174022
[root@k8s-node1 mysql]# docker stop ec989f174022
ec989f174022
[root@k8s-node1 mysql]# docker rm ec989f174022
CREATE DATABASE sonardb CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON sonardb.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL PRIVILEGES ON sonardb.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;