[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)Active: active (running) since Tue 2022-11-22 18:55:55 CST; 1 day 22h agoDocs: https://docs.docker.comMain PID: 11080 (dockerd)Tasks: 26Memory: 1.7GCGroup: /system.slice/docker.service└─11080 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sockNov 23 19:15:33 jeven dockerd[11080]: time="2022-11-23T19:15:33.027720042+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:15:34 jeven dockerd[11080]: time="2022-11-23T19:15:34.051871774+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:15:34 jeven dockerd[11080]: time="2022-11-23T19:15:34.987822341+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:15:36 jeven dockerd[11080]: time="2022-11-23T19:15:36.117949794+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:15:37 jeven dockerd[11080]: time="2022-11-23T19:15:37.518220737+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:15:39 jeven dockerd[11080]: time="2022-11-23T19:15:39.670714951+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:15:43 jeven dockerd[11080]: time="2022-11-23T19:15:43.532403741+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:15:50 jeven dockerd[11080]: time="2022-11-23T19:15:50.592195925+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:16:04 jeven dockerd[11080]: time="2022-11-23T19:16:04.062121075+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Nov 23 19:16:30 jeven dockerd[11080]: time="2022-11-23T19:16:30.334182866+08:00" level=info msg="ignoring event" container=682123a5e3ab725...skDelete"
Hint: Some lines were ellipsized, use -l to show in full.
二、使用Docker部署mysql
1.下载mysql镜像
[root@jeven ~]# docker pull mysql:5.7
5.7: Pulling from library/mysql
Digest: sha256:f2ad209efe9c67104167fc609cca6973c8422939491c9345270175a300419f94
Status: Image is up to date for mysql:5.7
docker.io/library/mysql:5.7
[root@jeven mysql]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
09a6697c529a mysql:5.7 "docker-entrypoint.s…" 56 seconds ago Up 53 seconds 33060/tcp, 0.0.0.0:3666->3306/tcp, :::3666->3306/tcp my-mysql
root@09a6697c529a:/# mysql -h 127.0.0.1 -P3306 -uroot -padmin
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.36 MySQL Community Server (GPL)Copyright (c) 2000, 2021, Oracle and/or its affiliates.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>
四、Linux系统安装Mysql
1.下载官方mysql的rpm包
[root@server ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
--2022-11-24 17:57:11-- http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 69.192.12.46, 2600:1417:e800:189::2e31, 2600:1417:e800:18a::2e31
Connecting to dev.mysql.com (dev.mysql.com)|69.192.12.46|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm [following]
--2022-11-24 17:57:11-- https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|69.192.12.46|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://repo.mysql.com//mysql57-community-release-el7-10.noarch.rpm [following]
--2022-11-24 17:57:11-- https://repo.mysql.com//mysql57-community-release-el7-10.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 2.16.232.230
Connecting to repo.mysql.com (repo.mysql.com)|2.16.232.230|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25548 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-10.noarch.rpm’100%[============================================================================================================>] 25,548 127KB/s in 0.2s 2022-11-24 17:57:12 (127 KB/s) - ‘mysql57-community-release-el7-10.noarch.rpm’ saved [25548/25548]-c: No such file or directory
No URLs found in -c.
FINISHED --2022-11-24 17:57:12--
Total wall clock time: 1.3s
Downloaded: 1 files, 25K in 0.2s (127 KB/s)
2.安装mysql的rpm包
[root@server ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
Loaded plugins: fastestmirror
Examining mysql57-community-release-el7-10.noarch.rpm: mysql57-community-release-el7-10.noarch
Marking mysql57-community-release-el7-10.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-10 will be installed
--> Finished Dependency ResolutionDependencies Resolved======================================================================================================================================================Package Arch Version Repository Size
======================================================================================================================================================
Installing:mysql57-community-release noarch el7-10 /mysql57-community-release-el7-10.noarch 30 kTransaction Summary
======================================================================================================================================================
Install 1 PackageTotal size: 30 k
Installed size: 30 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : mysql57-community-release-el7-10.noarch 1/1 Verifying : mysql57-community-release-el7-10.noarch 1/1 Installed:mysql57-community-release.noarch 0:el7-10 Complete!
3.修改mysql-community.repo文件
sed -i "s/gpgcheck=1/gpgcheck=0/g" mysql-community.repo
[root@server yum.repos.d]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2022-11-24 18:05:02 CST; 29s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlMain PID: 21810 (mysqld)CGroup: /system.slice/mysqld.service└─21810 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidNov 24 18:04:57 server systemd[1]: Starting MySQL Server...
Nov 24 18:05:02 server systemd[1]: Started MySQL Server.
8.本地连接mysql
[root@server yum.repos.d]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.40 MySQL Community Server (GPL)Copyright (c) 2000, 2022, Oracle and/or its affiliates.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>
五、mysql客户端远程连接mysql容器服务
[root@server ~]# mysql -h 192.168.3.166 -P3666 -uroot -padmin
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.36 MySQL Community Server (GPL)Copyright (c) 2000, 2018, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| data |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.12 sec)mysql>