MySQL :: MySQL Installation Guide :: 7.6.1 Basic Steps for MySQL Server Deployment with Docker
MySQL :: MySQL Installation Guide :: 7.6.1 Basic Steps for MySQL Server Deployment with Docker
The MySQL Docker images maintained by the MySQL team are built specifically for Linux platforms. Other platforms are not supported, and users using these MySQL Docker images on them are doing so at their own risk. See the discussion here for some known limitations for running these containers on non-Linux operating systems.
不填写tag,直接获取最新版本的
docker pull mysql/mysql-server 这个命令,直接在cmd或者Powershell里面执行
Using default tag: latest
然后Docker Desktop的Images菜单里面可以看到
docker images 这个命令查看images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql/mysql-server latest 1d9c2219ff69 7 weeks ago 496MB
Starting a MySQL Server Instance
To start a new Docker container for a MySQL Server, use the following command:
docker run --name=container_name --restart on-failure -d image_name:tag
The image name can be obtained using the docker images command, as explained in Downloading a MySQL Server Docker Image.
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2c1c9dffe6c0 mysql/mysql-server:latest "/entrypoint.sh mysq…" 3 minutes ago Up 3 minutes (healthy) 3306/tcp, 33060-33061/tcp festive_leavitt
按照下面这个运行,这样本机和docker之间建立映射关系
docker run -e MYSQL_ROOT_PASSWORD=root -p 3307:3307 mysql
三、将容器指定端口指定映射到宿主机的一个端口上。
例如:
docker run -p 8000:80 -it ubuntu /bin/bash
以上指令会将容器的80端口映射到宿主机的8000端口上。
作者:meieugene
链接:https://www.jianshu.com/p/b92d4b845ed6
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
在mysql的container的terminal里面
mysql -u root -p
show databases; 这里的冒号不能省略
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
MySQL :: MySQL 8.0 Reference Manual :: 4.2.4 Connecting to the MySQL Server Using Command Options
mysql --host=localhost --port=3307 -u root -p
MySQL :: MySQL 8.0 Reference Manual :: 6.2.1 Account User Names and Passwords
MySQL stores accounts in the user
table of the mysql
system database. An account is defined in terms of a user name and the client host or hosts from which the user can connect to the server. For information about account representation in the user
table, see Section 6.2.3, “Grant Tables”.
cybuster:
两个container需要通信的时候需要在主动连接那侧加上 --link 容器名:别名 的参数
cybuster:
docker run -d -e PMA_ARBITRARY=1 --link charming_liskov:mysql -p 8080:80 phpmyadmin/phpmyadmin
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2022-03-11 CSS opacity 属性
2021-03-11 nvarchar(max) still being truncated
2020-03-11 The view 'Index' or its master was not found.
2019-03-11 JMeter -- Getting Started
2019-03-11 237. Delete Node in a Linked List
2016-03-11 SuperSocket中的Server的初始化和启动
2016-03-11 SuperSocket中的Server是如何初Start的