mac docker 安装mysql

2022/6/14 2:20:14

本文主要是介绍mac docker 安装mysql,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

ivys-MacBook-Pro:~ txp$ cd 
ivys-MacBook-Pro:~ txp$ ls
Desktop        IdeaProjects    Music        flagship
Documents    Library        Pictures    mysql
Downloads    Movies        Public
ivys-MacBook-Pro:~ txp$ cd mysql/
ivys-MacBook-Pro:mysql txp$ ls
data
ivys-MacBook-Pro:mysql txp$ mkdir -p conf
ivys-MacBook-Pro:mysql txp$ ls
conf    data
ivys-MacBook-Pro:mysql txp$ cd conf
ivys-MacBook-Pro:conf txp$ ls
ivys-MacBook-Pro:conf txp$ mkfile docker.cnf
usage: mkfile [-nv] size[b|k|m|g] filename ...
ivys-MacBook-Pro:conf txp$ ls
ivys-MacBook-Pro:conf txp$ mkfile -n docker.cnf
usage: mkfile [-nv] size[b|k|m|g] filename ...
ivys-MacBook-Pro:conf txp$ mkfile -n 1mb docker.cnf
ivys-MacBook-Pro:conf txp$ ls
docker.cnf
ivys-MacBook-Pro:conf txp$ mkfile -n 1mb mysql.cnf
ivys-MacBook-Pro:conf txp$ mkfile -n 1mb mysqldump.cnf
ivys-MacBook-Pro:conf txp$ ls
docker.cnf    mysql.cnf    mysqldump.cnf
ivys-MacBook-Pro:conf txp$ touch docker.cnf
ivys-MacBook-Pro:conf txp$ vim docker.cnf
ivys-MacBook-Pro:conf txp$ ls
docker.cnf    mysql.cnf    mysqldump.cnf
ivys-MacBook-Pro:conf txp$ vim mysql.cnf
ivys-MacBook-Pro:conf txp$ touch mysql.cnf
ivys-MacBook-Pro:conf txp$ touch mysql.cnf -100
ivys-MacBook-Pro:conf txp$ vim mysqldump.cnf
ivys-MacBook-Pro:conf txp$ docker run -d --name mysql57 --net=backend -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -v /mysql/data:/var/lib/mysql -v /mysql/conf:/etc/mysql/conf.d mysql:5.7.21
Unable to find image 'mysql:5.7.21' locally
5.7.21: Pulling from library/mysql
2a72cbf407d6: Pull complete 
38680a9b47a8: Pull complete 
4c732aa0eb1b: Pull complete 
c5317a34eddd: Pull complete 
f92be680366c: Pull complete 
e8ecd8bec5ab: Pull complete 
2a650284a6a8: Pull complete 
5b5108d08c6d: Pull complete 
beaff1261757: Pull complete 
c1a55c6375b5: Pull complete 
8181cde51c65: Pull complete 
Digest: sha256:691c55aabb3c4e3b89b953dd2f022f7ea845e5443954767d321d5f5fa394e28c
Status: Downloaded newer image for mysql:5.7.21
0d07ab9cdd252f73b92c39be112842567fa8d8a15ef4259d2565da0c617ef36d
docker: Error response from daemon: Mounts denied: 
The path /mysql/data is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.
ivys-MacBook-Pro:conf txp$ open mysql
The file /Users/txp/mysql/conf/mysql does not exist.
ivys-MacBook-Pro:conf txp$ cd ~/
ivys-MacBook-Pro:~ txp$ open mysql
ivys-MacBook-Pro:~ txp$ docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
mysql        5.7.21    5195076672a7   4 years ago   371MB

 



这篇关于mac docker 安装mysql的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程