install mysql in docker
# step-1: configure mysql_port='3306' mysql_password='123qwe' mysql_data_dir="~/docker/mysqld_${mysql_port}/data" # step-2: delete-database-if-exist docker rm -f mysqld_${mysql_port} docker run -it --rm -v ~:/root alpine sh -c "rm -r ${mysql_data_dir}" # step-3: start-new-mysql-server mkdir -p `bash -c "echo ${mysql_data_dir}"` docker run -d -p ${mysql_port}:3306 --name mysqld_${mysql_port} \ -v `bash -c "echo ${mysql_data_dir}"`:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD="${mysql_password}" \ docker.io/library/mysql:5.7 docker attach --sig-proxy=false mysqld_${mysql_port}
标签:mysqld,install,mysql,docker,data,port,dir From: https://www.cnblogs.com/xiangxisheng/p/17236852.html