[root@host1 ~]# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mysql 5.7 4d1bf91a2e39 37 hours ago 435 MB
docker.io/postgres 9.6 2e95ec592d5a 2 days ago 250 MB
docker run -itd --name mysql5.7 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
[root@host1 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
74fe49e4c570 mysql:5.7 "docker-entrypoint..." 3 minutes ago Up 3 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql5.7
[root@host1 ~]#
[root@host1 ~]#
[root@host1 ~]#
[root@host1 ~]# docker exec -it mysql5.7 /bin/bash
root@74fe49e4c570:/# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
docker运行安装mysql
猜你喜欢
转载自www.cnblogs.com/JuncaiF/p/12376449.html
今日推荐
周排行