首页 / DOCKER / docker运行安装mysql
docker运行安装mysql
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了docker运行安装mysql,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1827字,纯文字阅读大概需要3分钟。
内容图文
安装mysql
[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>
安装postgres
[root@host1 ~]# docker run --name postgres9.6 -e POSTGRES_PASSWORD=123456 -p 5432:5432 -d postgres:9.6
f53027308a44ac1aa6d1247fda115b04eb822d44d17ce905d1c19b0eef2a8b13
[root@host1 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f53027308a44 postgres:9.6 "docker-entrypoint..." 3 seconds ago Up 2 seconds 0.0.0.0:5432->5432/tcp postgres9.6
74fe49e4c570 mysql:5.7 "docker-entrypoint..." About an hour ago Up About an hour 0.0.0.0:3306->3306/tcp, 33060/tcp mysql5.7
[root@host1 ~]# docker exec -it postgres9.6 /bin/bash
root@f53027308a44:/#
root@f53027308a44:/#
root@f53027308a44:/# psql -U postgres
psql (9.6.17)
Type "help" for help.
postgres=#
postgres=#
原文:https://www.cnblogs.com/JuncaiF/p/12376449.html
内容总结
以上是互联网集市为您收集整理的docker运行安装mysql全部内容,希望文章能够帮你解决docker运行安装mysql所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。