下载mysql5.7镜像
docker pull mysql:5.7
启动mysql5.7
docker run -d -p 3306:3306 --privileged=true -v /etc/docker/mysql/conf:/etc/mysql/conf.d -v /etc/docker/mysql/logs:/etc/mysql/logs -v /etc/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql5.7 mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --lower_case_table_names=1 --skip-name-resolve=1 --max_connections=1000 --wait_timeout=31536000 --interactive_timeout=31536000 --default-time-zone='+8:00'
进入docker内部mysql中
docker exec -it mysql5.7 bash
登陆mysql
mysql -uroot -p
创建账号
GRANT ALL PRIVILEGES ON *.* TO 'xxxxx'@'%' IDENTIFIED BY 'xxxxx' WITH GRANT OPTION;
网友评论