docker安装数据库,进入mysql镜像创建数据库等数据

209 2023-04-11 15:08:54 root yum -y install yum-utils
210 2023-04-11 15:11:06 root yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
211 2023-04-11 15:11:28 root yum install docker-ce docker-ce-cli containerd.io
212 2023-04-11 15:13:52 root sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://yxzrazem.mirror.aliyuncs.com"]
}
EOF

213 2023-04-11 15:13:52 root sudo systemctl daemon-reload
214 2023-04-11 15:13:54 root sudo systemctl restart docker
215 2023-04-11 15:14:04 root cat /etc/docker/daemon.json
216 2023-04-11 15:14:16 root systemctl status docker;
217 2023-04-11 15:14:26 root ip a
218 2023-04-11 15:15:00 root docker pull mysql:5.7
219 2023-04-11 15:16:22 root docker images
220 2023-04-11 15:16:27 root docker ps
221 2023-04-11 15:16:47 root docker run --name mysql5.7
222 2023-04-11 15:17:05 root docker run --name mysql5.7 -d
223 2023-04-11 15:20:44 root docker run --name mysql5.7 -d -p 3306:3306 --restart unless-stopped -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/lib/mysql -v /mydata/mysql/conf:/etc/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
224 2023-04-11 15:21:07 root docker ps
225 2023-04-11 15:21:20 root docker images;
226 2023-04-11 15:22:54 root docker ps
227 2023-04-11 15:23:07 root docker exec -it 197
228 2023-04-11 15:23:17 root docker exec -it 197 bash
229 2023-04-11 15:31:25 root ls /mydata/mysql/log
230 2023-04-11 15:31:30 root ls /mydata
231 2023-04-11 15:31:46 root ls mydata/mysql/data
232 2023-04-11 15:31:52 root ls /mydata/mysql/data
233 2023-04-11 15:32:02 root ls /mydata/mysql/conf
234 2023-04-11 15:32:20 root netstat -ntulp
235 2023-04-11 15:32:33 root service mysql status;
236 2023-04-11 15:32:46 root /bin/systemctl status mysql
237 2023-04-11 15:32:52 root ps
238 2023-04-11 15:33:07 root ps -ef
239 2023-04-11 15:33:28 root docker ps
240 2023-04-11 15:33:47 root docker exec -it 197 /bin/bash
241 2023-04-11 15:34:48 root history

 

 

 

posted @ 2023-04-11 15:41  往事已成昨天  阅读(115)  评论(0编辑  收藏  举报