博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
docker启动Mysql(转)
阅读量:5917 次
发布时间:2019-06-19

本文共 3536 字,大约阅读时间需要 11 分钟。

cs202@cs202-devbox:~$ sudo docker run -d mysql

7698fdd7a2d05d38cf19c60cc9e35c1117fc551ae5e319144947154f4f353d23
cs202@cs202-devbox:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
257646e19a08        ubuntu              "/bin/bash"         26 minutes ago      Up 13 minutes                           desperate_ardinghelli
cs202@cs202-devbox:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES
7698fdd7a2d0        mysql               "/entrypoint.sh mysql"   18 seconds ago      Exited (1) 17 seconds ago                       desperate_swanson
151a8113ba67        mysql               "/entrypoint.sh mysql"   5 minutes ago       Exited (1) 5 minutes ago                        hopeful_williams
257646e19a08        ubuntu              "/bin/bash"              27 minutes ago      Up 13 minutes                                   desperate_ardinghelli
发现并没有成功启动,查看日志:
cs202@cs202-devbox:~$ sudo docker logs desperate_swanson
error: database is uninitialized and password option is not specified 
  You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
于是设置MYSQL_ROOT_PASSWORD:
sudo docker run  -e MYSQL_ROOT_PASSWORD=wwwwww --name mysql -d mysql
总算启动成功了:
^Ccs202@cs202-devbox:~sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
b50461bd8135        mysql               "/entrypoint.sh mysql"   4 minutes ago       Up 4 minutes        3306/tcp            mysql
257646e19a08        ubuntu              "/bin/bash"              37 minutes ago      Up 23 minutes                           desperate_ardinghelli
cs202@cs202-devbox:~$ 
后台打印出大片日志:
cs202@cs202-devbox:~$ sudo docker logs -f mysql
2016-03-12T02:50:26.302319Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-03-12T02:50:26.375013Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-03-12T02:50:26.375515Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-03-12T02:50:26.444508Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-03-12T02:50:26.446893Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-03-12T02:50:26.447017Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-03-12T02:50:26.451067Z 0 [Note] InnoDB: Waiting for purge to start
2016-03-12T02:50:26.504451Z 0 [Note] InnoDB: 5.7.11 started; log sequence number 11991512
2016-03-12T02:50:26.505028Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-03-12T02:50:26.508912Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-03-12T02:50:26.509170Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-03-12T02:50:26.509310Z 0 [Note] IPv6 is available.
2016-03-12T02:50:26.509366Z 0 [Note]   - '::' resolves to '::';
2016-03-12T02:50:26.509419Z 0 [Note] Server socket created on IP: '::'.
2016-03-12T02:50:26.509154Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-03-12T02:50:26.519321Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-03-12T02:50:26.519569Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2016-03-12T02:50:26.544083Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160312  2:50:26
2016-03-12T02:50:26.548848Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-03-12T02:50:26.565564Z 0 [Note] Event Scheduler: Loaded 0 events
2016-03-12T02:50:26.566266Z 0 [Note] mysqld: ready for connections.
Version: '5.7.11'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
如果需要指定端口的话,加-p选项:
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql/mysql-server:latest

转载地址:http://srfvx.baihongyu.com/

你可能感兴趣的文章
【JS学习】慕课网8-17编程练习 网页的返回与跳转
查看>>
python核心编程(第三版)网络编程错误修改
查看>>
nginx 中 root和alias
查看>>
chgrp命令
查看>>
python3+selenium框架设计09-生成测试报告
查看>>
Microsoft Azure部署MYSQL-MMM(1)安装MYSQL
查看>>
《反精益创业》第二章
查看>>
Linux磁盘管理之LVM2 逻辑卷管理工具
查看>>
component SMS_WSUS_SYNC_MANAGER on computer NLACC00W3SD001 reported: SMS WSUS
查看>>
zabbix专题:第十章 zabbix自动发现功能详解
查看>>
2012过年回家:火车站步步惊心
查看>>
Android第二十二期 - QQ5.0版本最简洁实现方法
查看>>
分布式爬虫系统设计、实现与实战:爬取京东、苏宁易购全网手机商品数据+MySQL、HBase存储...
查看>>
Android Studio 第六十期 - Android推流直播(斗鱼部分页面功能)
查看>>
如何在数据库中存储一棵树
查看>>
enq: SQ – contention、cursor: pin S wait on X等事件引发的故障处理
查看>>
通过两个案例初步了解Linux下selinux的安全机制工作机制
查看>>
使用Python的twisted和socket模块实现端口的负载分发
查看>>
JMX rmi的一些问题
查看>>
JQuery UI - tabs
查看>>