mysql docker 配置

懵懂的女人 提交于 2019-12-04 14:03:50

安装

  主机上的mysql服务是基于docker安装的,具体安装脚本如下:

docker run  --detach \
--restart always \
--publish 3306:3306 --name mysql \
--volume /data/mysql/logs:/logs \
--volume /data/mysql/data:/mysql_data \
-e MYSQL_ROOT_PASSWORD=123456 \
mysql:5.7.28

重启

docker restart mysql

关闭

docker stop mysql

卸载

docker rm mysql

访问

lwk@qwfys:~$ mysql -h cvm00.xtwj.com -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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> 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!