1. Start a mysql container:
$docker run -p 3306:3306 --name mysql-server-1 -e MYSQL_ROOT_PASSWORD=welcome1 -v /scratch/cdctest/work/data/:/var/lib/mysql -d mysql
note: /scratch/cdctest/work/data/, the directory in docker host, used for data persistence.
2. Initialize mysql database:
$mysql -u root -p
Create a user named with cdctest
mysql> CREATE USER cdctest IDENTIFIED BY 'MyTest1@';mysql> grant all privileges on *.* to cdctest@"%" with grant option;mysql> flush privileges;
$mysql -u cdctest -p