1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
在mysql官网获取yum源安装包
http://dev.mysql.com/downloads/repo/yum/
复制下载链接地址为:
mysql80-community-release-el7-7.noarch.rpm
A Quick Guide to Using the MySQL Yum Repository
wget https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
rpm -ivh mysql80-community-release-el7-7.noarch.rpm
yum install mysql-community-server -y
启动mysql
service mysqld start
# 关闭mysql
service mysqld stop
# 查看启动状态
service mysqld status
# 重启mysql
service mysqld restart
# 查看默认密码
sudo grep 'temporary password' /var/log/mysqld.log
因此,请遵守容器设计原则,一个容器里运行一个前台服务!
报错1:
docker centos 使用 systemctl Failed to get D-Bus connection: Operation not permitted
docker ps -a
3346da816048
docker start 3346da816048
ssh root@10.2.131.60 -p 22 (宿主机器IP)
docker exec -it 3346da816048 /usr/sbin/init
docker run --privileged -ti -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup centos /usr/sbin/init
创建容器:
docker-failed-to-get-d-bus-connection-operation-not-permitted
# docker run -d -name centos7 --privileged=true centos:7 /usr/sbin/init
进入容器:
# docker exec -it centos7 /bin/bash
这样可以使用systemctl启动服务了。
|