linux上mysql的四种安装方式

MySQL的四种安装方式

1、仓库安装

# 先在mysql官网上找到需要版本的域名然后用rpm安装下载下来
[root@192 ~]# rpm -ivh  https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
获取https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql80-community-release-el9-1  ################################# [100%]
   
# 然后安装mysql服务器
[root@192 ~]# dnf install mysql-server -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

上次元数据过期检查:1:04:32 前,执行于 Sat 11 Feb 2023 00:44:29 CST。
依赖关系解决。
========================================================================================================================
 软件包                                    架构              版本                    仓库                          大小
========================================================================================================================
安装:
 mysql-community-server                    x86_64            8.0.32-1.el9            mysql80-community             49 M
安装依赖关系:
 mysql-community-client                    x86_64            8.0.32-1.el9            mysql80-community            3.9 M
 mysql-community-client-plugins            x86_64            8.0.32-1.el9            mysql80-community            1.4 M
 mysql-community-common                    x86_64            8.0.32-1.el9            mysql80-community            544 k
 mysql-community-icu-data-files            x86_64            8.0.32-1.el9            mysql80-community            2.2 M
 mysql-community-libs                      x86_64            8.0.32-1.el9            mysql80-community            1.5 M

事务概要
========================================================================================================================
安装  6 软件包

总下载:59 M
安装大小:335 M
下载软件包:
(1/6): mysql-community-common-8.0.32-1.el9.x86_64.rpm                                   368 kB/s | 544 kB     00:01
(2/6): mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm                           844 kB/s | 1.4 MB     00:01
(3/6): mysql-community-client-8.0.32-1.el9.x86_64.rpm                                   1.9 MB/s | 3.9 MB     00:02
(4/6): mysql-community-icu-data-files-8.0.32-1.el9.x86_64.rpm                           2.9 MB/s | 2.2 MB     00:00
(5/6): mysql-community-libs-8.0.32-1.el9.x86_64.rpm                                     1.6 MB/s | 1.5 MB     00:00
(6/6): mysql-community-server-8.0.32-1.el9.x86_64.rpm                                   7.4 MB/s |  49 MB     00:06
------------------------------------------------------------------------------------------------------------------------
总计                                                                                    6.7 MB/s |  59 MB     00:08
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                         1/1
  安装    : mysql-community-common-8.0.32-1.el9.x86_64                                                              1/6
  安装    : mysql-community-client-plugins-8.0.32-1.el9.x86_64                                                      2/6
  安装    : mysql-community-libs-8.0.32-1.el9.x86_64                                                                3/6
  运行脚本: mysql-community-libs-8.0.32-1.el9.x86_64                                                                3/6
  安装    : mysql-community-client-8.0.32-1.el9.x86_64                                                              4/6
  安装    : mysql-community-icu-data-files-8.0.32-1.el9.x86_64                                                      5/6
  运行脚本: mysql-community-server-8.0.32-1.el9.x86_64                                                              6/6
  安装    : mysql-community-server-8.0.32-1.el9.x86_64                                                              6/6
  运行脚本: mysql-community-server-8.0.32-1.el9.x86_64                                                              6/6
  验证    : mysql-community-client-8.0.32-1.el9.x86_64                                                              1/6
  验证    : mysql-community-client-plugins-8.0.32-1.el9.x86_64                                                      2/6
  验证    : mysql-community-common-8.0.32-1.el9.x86_64                                                              3/6
  验证    : mysql-community-icu-data-files-8.0.32-1.el9.x86_64                                                      4/6
  验证    : mysql-community-libs-8.0.32-1.el9.x86_64                                                                5/6
  验证    : mysql-community-server-8.0.32-1.el9.x86_64                                                              6/6
已更新安装的产品。

已安装:
  mysql-community-client-8.0.32-1.el9.x86_64             mysql-community-client-plugins-8.0.32-1.el9.x86_64
  mysql-community-common-8.0.32-1.el9.x86_64             mysql-community-icu-data-files-8.0.32-1.el9.x86_64
  mysql-community-libs-8.0.32-1.el9.x86_64               mysql-community-server-8.0.32-1.el9.x86_64

完毕!
[root@192 ~]# rpm -qa | grep mysql
mysql80-community-release-el9-1.noarch
mysql-community-common-8.0.32-1.el9.x86_64
mysql-community-client-plugins-8.0.32-1.el9.x86_64
mysql-community-libs-8.0.32-1.el9.x86_64
mysql-community-client-8.0.32-1.el9.x86_64
mysql-community-icu-data-files-8.0.32-1.el9.x86_64
mysql-community-server-8.0.32-1.el9.x86_64
# 启动 mysql
[root@192 ~]# systemctl start mysqld
[root@192 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2023-02-11 01:51:50 CST; 5s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 5116 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 5186 (mysqld)
     Status: "Server is operational"
      Tasks: 39 (limit: 36075)
     Memory: 474.3M
        CPU: 4.779s
     CGroup: /system.slice/mysqld.service
             └─5186 /usr/sbin/mysqld

Feb 11 01:51:44 192.168.156.128 systemd[1]: Starting MySQL Server...
Feb 11 01:51:50 192.168.156.128 systemd[1]: Started MySQL Server.
# mysql的初始密码在/var/log/mysqld.log日志文件里,通过用grep 筛查出来
[root@192 ~]# grep 'temporary password' /var/log/mysqld.log
2023-02-10T17:51:47.367433Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 9BtdoxMOvn.Y
# -u用户名 -p密码
[root@192 ~]# mysql -uroot -p'9BtdoxMOvn.Y'
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 8
Server version: 8.0.32

Copyright (c) 2000, 2023, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!';
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

2、本地安装

[root@192 ~]# mkdir mysql
[root@192 ~]# cd mysql/
# 把需要的tar包下下来
[root@192 mysql]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
--2023-02-11 02:02:42--  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
正在解析主机 cdn.mysql.com (cdn.mysql.com)... 223.119.242.56
正在连接 cdn.mysql.com (cdn.mysql.com)|223.119.242.56|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:849367040 (810M) [application/x-tar]
正在保存至: “mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar”

mysql-8.0.32-1.el9.x86_64.rpm 100%[=================================================>] 810.02M  11.2MB/s  用时 75s

2023-02-11 02:03:58 (10.8 MB/s) - 已保存 “mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar” [849367040/849367040])

# 解压刚刚的打包文件
[root@192 mysql]# tar xf mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar
mysql-community-client-8.0.32-1.el9.x86_64.rpm
mysql-community-client-debuginfo-8.0.32-1.el9.x86_64.rpm
mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm
mysql-community-client-plugins-debuginfo-8.0.32-1.el9.x86_64.rpm
mysql-community-common-8.0.32-1.el9.x86_64.rpm
mysql-community-debuginfo-8.0.32-1.el9.x86_64.rpm
mysql-community-debugsource-8.0.32-1.el9.x86_64.rpm
mysql-community-devel-8.0.32-1.el9.x86_64.rpm
mysql-community-icu-data-files-8.0.32-1.el9.x86_64.rpm
mysql-community-libs-8.0.32-1.el9.x86_64.rpm
mysql-community-libs-debuginfo-8.0.32-1.el9.x86_64.rpm
mysql-community-server-8.0.32-1.el9.x86_64.rpm
mysql-community-server-debug-8.0.32-1.el9.x86_64.rpm
mysql-community-server-debug-debuginfo-8.0.32-1.el9.x86_64.rpm
mysql-community-server-debuginfo-8.0.32-1.el9.x86_64.rpm
mysql-community-test-8.0.32-1.el9.x86_64.rpm
mysql-community-test-debuginfo-8.0.32-1.el9.x86_64.rpm
# 把依赖的包全部安装
[root@192 mysql]# rpm -ivh mysql-community-server-8.0.32-1.el9.x86_64.rpm mysql-community-client-8.0.32-1.el9.x86_64.rpm mysql-community-common-8.0.32-1.el9.x86_64.rpm mysql-community-icu-data-files-8.0.32-1.el9.x86_64.rpm mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm mysql-community-libs-8.0.32-1.el9.x86_64.rpm
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-client-plugins-8.################################# [ 17%]
   2:mysql-community-common-8.0.32-1.e################################# [ 33%]
   3:mysql-community-libs-8.0.32-1.el9################################# [ 50%]
   4:mysql-community-client-8.0.32-1.e################################# [ 67%]
   5:mysql-community-icu-data-files-8.################################# [ 83%]
   6:mysql-community-server-8.0.32-1.e################################# [100%]
 # 启动mysql
[root@192 mysql]# systemctl start mysqld
[root@192 mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2023-02-11 02:47:11 CST; 1min 45s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 5961 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 6031 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 36075)
     Memory: 466.7M
        CPU: 17.551s
     CGroup: /system.slice/mysqld.service
             └─6031 /usr/sbin/mysqld

Feb 11 02:46:48 192.168.156.128 systemd[1]: Starting MySQL Server...
Feb 11 02:47:11 192.168.156.128 systemd[1]: Started MySQL Server.

[root@192 ~]# grep 'temporary password' /var/log/mysqld.log
2023-02-10T18:46:56.861106Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 8dm_djQjW5&;

[root@192 ~]# mysql -uroot -p'8dm_djQjW5&;'
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 18
Server version: 8.0.32

Copyright (c) 2000, 2023, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!';
Query OK, 0 rows affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

3、容器安装

[root@192 ~]# dnf install -y yum-utils device-mapper-persistent-data lvm2
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

上次元数据过期检查:1:47:42 前,执行于 Sat 11 Feb 2023 15:08:09 CST。
软件包 device-mapper-persistent-data-0.9.0-13.el9.x86_64 已安装。
软件包 lvm2-9:2.03.16-3.el9.x86_64 已安装。
依赖关系解决。
========================================================================================================================
 软件包                       架构                      版本                              仓库                     大小
========================================================================================================================
安装:
 yum-utils                    noarch                    4.1.0-3.el9                       base                     45 k

事务概要
========================================================================================================================
安装  1 软件包

总计:45 k
安装大小:23 k
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                         1/1
  安装    : yum-utils-4.1.0-3.el9.noarch                                                                            1/1
  运行脚本: yum-utils-4.1.0-3.el9.noarch                                                                            1/1
  验证    : yum-utils-4.1.0-3.el9.noarch                                                                            1/1
已更新安装的产品。

已安装:
  yum-utils-4.1.0-3.el9.noarch

完毕!
[root@192 ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

添加仓库自:https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

[root@192 ~]# systemctl start docker
[root@192 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
     Active: active (running) since Sat 2023-02-11 17:12:32 CST; 7s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 9559 (dockerd)
      Tasks: 7
     Memory: 24.5M
        CPU: 173ms
     CGroup: /system.slice/docker.service
             └─9559 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Feb 11 17:12:31 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:31.723160244+08:00" level=info msg="[core] [Chann>
Feb 11 17:12:31 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:31.763898158+08:00" level=info msg="Loading conta>
Feb 11 17:12:32 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:32.443463649+08:00" level=info msg="Default bridg>
Feb 11 17:12:32 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:32.626962098+08:00" level=info msg="Firewalld: in>
Feb 11 17:12:32 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:32.854013030+08:00" level=info msg="Loading conta>
Feb 11 17:12:32 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:32.887442173+08:00" level=info msg="Docker daemon>
Feb 11 17:12:32 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:32.888149989+08:00" level=info msg="Daemon has co>
Feb 11 17:12:32 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:32.918032658+08:00" level=info msg="[core] [Serve>
Feb 11 17:12:32 192.168.156.128 systemd[1]: Started Docker Application Container Engine.
Feb 11 17:12:32 192.168.156.128 dockerd[9559]: time="2023-02-11T17:12:32.935974546+08:00" level=info msg="API listen on
[root@192 ~]# docker version
Client: Docker Engine - Community
 Version:           23.0.1
 API version:       1.42
 Go version:        go1.19.5
 Git commit:        a5ee5b1
 Built:             Thu Feb  9 19:49:35 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.1
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.5
  Git commit:       bc3805a
  Built:            Thu Feb  9 19:46:32 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.16
  GitCommit:        31aa4358a36870b21a992d3ad2bef29e1d693bec
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  [root@192 ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9fe
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[root@192 ~]# docker run --name mysqltest -e MYSQL_ROOT_PASSWORD=123456 -d mysql
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
197c1adcd755: Pull complete
45f2e353f7d2: Pull complete
68ec6ece42ef: Pull complete
cfa4d9a7b88e: Pull complete
64cab5858b1d: Pull complete
92fcd248d982: Pull complete
88635e83312d: Pull complete
43f0427259d9: Pull complete
79828698a290: Pull complete
a8854781893e: Pull complete
6c8bdf3091d9: Pull complete
Digest: sha256:8653a170e0b0df19ea95055267def2615fc53c62df529e3750817c1a886485f0
Status: Downloaded newer image for mysql:latest
5b302002a446102547fff41738569cd4cb05f372e5e273d9e068c2501b113573
[root@192 ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                   CREATED         STATUS         PORTS                 NAMES
5b302002a446   mysql     "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes   3306/tcp, 33060/tcp   mysqltest
[root@192 ~]# docker exec -it mysqltest /bin/bash
bash-4.4# mysql -uroot -p
bash-4.4#
bash-4.4#
bash-4.4#
bash-4.4#
bash-4.4#
bash-4.4# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.32 MySQL Community Server - GPL

Copyright (c) 2000, 2023, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)


4、源码安装

[root@192 ~]# wget  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.32.tar.gz
--2023-02-11 18:36:31--  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.32.tar.gz
正在解析主机 cdn.mysql.com (cdn.mysql.com)... 2.19.84.217
正在连接 cdn.mysql.com (cdn.mysql.com)|2.19.84.217|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:436207624 (416M) [application/x-tar-gz]
正在保存至: “mysql-boost-8.0.32.tar.gz.1”

mysql-boost-8.0.32.tar.gz.1   100%[=================================================>] 416.00M  7.60MB/s  用时 62s

2023-02-11 18:37:34 (6.76 MB/s) - 已保存 “mysql-boost-8.0.32.tar.gz.1” [436207624/436207624])

#添加用户和组
[root@192 ~]# groupadd mysql
groupadd:“mysql”组已存在
[root@192 ~]# useradd -r -g mysql -s /bin/false mysql
useradd:用户“mysql”已存在
#开始源码安装
[root@192 ~]# tar xvf mysql-boost-8.0.32.tar.gz
mysql-8.0.32/
mysql-8.0.32/.clang-format
mysql-8.0.32/.gitconfig
mysql-8.0.32/CMakeLists.txt
mysql-8.0.32/Docs/
mysql-8.0.32/Docs/README.build
mysql-8.0.32/Docs/mysql.info
mysql-8.0.32/Docs/sp-imp-spec.txt
mysql-8.0.32/Docs/INFO_SRC
mysql-8.0.32/Doxyfile-ignored
mysql-8.0.32/Doxyfile.in
mysql-8.0.32/INSTALL
mysql-8.0.32/LICENSE
mysql-8.0.32/MYSQL_VERSION
mysql-8.0.32/README
mysql-8.0.32/client/
mysql-8.0.32/client/CMakeLists.txt
mysql-8.0.32/client/base/
mysql-8.0.32/client/base/CMakeLists.txt
mysql-8.0.32/client/base/abstract_connection_program.cc
[root@192 ~]# yum install gcc gcc-c++ cmake -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

上次元数据过期检查:0:45:37 前,执行于 Sat 11 Feb 2023 18:12:12 CST。
依赖关系解决。
========================================================================================================================
 软件包                          架构                  版本                                   仓库                 大小
========================================================================================================================
安装:
 cmake                           x86_64                3.20.2-7.el9                           app                 6.7 M
 gcc                             x86_64                11.3.1-2.1.el9                         app                  32 M
 gcc-c++                         x86_64                11.3.1-2.1.el9                         app                  13 M
安装依赖关系:
 cmake-data                      noarch                3.20.2-7.el9                           app                 2.1 M
 cmake-filesystem                x86_64                3.20.2-7.el9                           app                  27 k
 cmake-rpm-macros                noarch                3.20.2-7.el9                           app                  17 k
 glibc-devel                     x86_64                2.34-40.el9                            app                  47 k
 glibc-headers                   x86_64                2.34-40.el9                            app                 547 k
 kernel-headers                  x86_64                5.14.0-162.6.1.el9_1                   app                 3.4 M
 libstdc++-devel                 x86_64                11.3.1-2.1.el9                         app                 2.4 M
 libxcrypt-devel                 x86_64                4.4.18-3.el9                           app                  32 k
 make                            x86_64                1:4.3-7.el9                            base                542 k

事务概要
========================================================================================================================
安装  12 软件包

总计:61 M
安装大小:173 M
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                         1/1
  安装    : cmake-rpm-macros-3.20.2-7.el9.noarch                                                                   1/12
  安装    : cmake-filesystem-3.20.2-7.el9.x86_64                                                                   2/12
  安装    : make-1:4.3-7.el9.x86_64                                                                                3/12
  安装    : cmake-data-3.20.2-7.el9.noarch                                                                         4/12
  安装    : cmake-3.20.2-7.el9.x86_64                                                                              5/12
  安装    : libstdc++-devel-11.3.1-2.1.el9.x86_64                                                                  6/12
  安装    : kernel-headers-5.14.0-162.6.1.el9_1.x86_64                                                             7/12
  安装    : glibc-headers-2.34-40.el9.x86_64                                                                       8/12
  安装    : libxcrypt-devel-4.4.18-3.el9.x86_64                                                                    9/12
  安装    : glibc-devel-2.34-40.el9.x86_64                                                                        10/12
  安装    : gcc-11.3.1-2.1.el9.x86_64                                                                             11/12
  安装    : gcc-c++-11.3.1-2.1.el9.x86_64                                                                         12/12
  运行脚本: gcc-c++-11.3.1-2.1.el9.x86_64                                                                         12/12
  验证    : make-1:4.3-7.el9.x86_64                                                                                1/12
  验证    : cmake-3.20.2-7.el9.x86_64                                                                              2/12
  验证    : cmake-data-3.20.2-7.el9.noarch                                                                         3/12
  验证    : cmake-filesystem-3.20.2-7.el9.x86_64                                                                   4/12
  验证    : cmake-rpm-macros-3.20.2-7.el9.noarch                                                                   5/12
  验证    : gcc-11.3.1-2.1.el9.x86_64                                                                              6/12
  验证    : gcc-c++-11.3.1-2.1.el9.x86_64                                                                          7/12
  验证    : glibc-devel-2.34-40.el9.x86_64                                                                         8/12
  验证    : glibc-headers-2.34-40.el9.x86_64                                                                       9/12
  验证    : kernel-headers-5.14.0-162.6.1.el9_1.x86_64                                                            10/12
  验证    : libstdc++-devel-11.3.1-2.1.el9.x86_64                                                                 11/12
  验证    : libxcrypt-devel-4.4.18-3.el9.x86_64                                                                   12/12
已更新安装的产品。

已安装:
  cmake-3.20.2-7.el9.x86_64             cmake-data-3.20.2-7.el9.noarch      cmake-filesystem-3.20.2-7.el9.x86_64
  cmake-rpm-macros-3.20.2-7.el9.noarch  gcc-11.3.1-2.1.el9.x86_64           gcc-c++-11.3.1-2.1.el9.x86_64
  glibc-devel-2.34-40.el9.x86_64        glibc-headers-2.34-40.el9.x86_64    kernel-headers-5.14.0-162.6.1.el9_1.x86_64
  libstdc++-devel-11.3.1-2.1.el9.x86_64 libxcrypt-devel-4.4.18-3.el9.x86_64 make-1:4.3-7.el9.x86_64

完毕!
[root@192 ~]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/CRB/x86_64/os/Packages/libtirpc-devel-1.3.3-0.el9.x86_64.rpm
获取https://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/CRB/x86_64/os/Packages/libtirpc-devel-1.3.3-0.el9.x86_64.rpm
警告:/var/tmp/rpm-tmp.5Pu21j: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:libtirpc-devel-1.3.3-0.el9       ################################# [100%]
[root@192 ~]# cd mysql-8.0.32/
[root@192 mysql-8.0.32]# mkdir bld
[root@192 mysql-8.0.32]# cd bld
[root@192 bld]# cmake .. -DWITH_BOOST=../boost/boost_1_77_0/
-- Running cmake version 3.20.2
-- Found Git: /usr/bin/git (found version "2.31.1")
-- This is .el9. as found from 'rpm -qf /'
-- CMAKE_MODULE_PATH is /root/mysql-8.0.32/cmake
-- MySQL 8.0.32
-- The C compiler identification is GNU 11.3.1
-- The CXX compiler identification is GNU 11.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Source directory /root/mysql-8.0.32
-- Binary directory /root/mysql-8.0.32/bld
-- CMAKE_GENERATOR: Unix Makefiles
[root@192 bld]# make
[  0%] Built target abi_check
[  0%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/adler32.c.o
[  0%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/compress.c.o
[  0%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/crc32.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/deflate.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/gzclose.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/gzlib.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/gzread.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/gzwrite.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/inflate.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/infback.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/inftrees.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/inffast.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/trees.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/uncompr.c.o
[  1%] Building C object extra/zlib/zlib-1.2.13/CMakeFiles/zlib_objlib.dir/zutil.c.o
[  1%] Built target zlib_objlib
[ 98%] Linking CXX executable ../../../runtime_output_directory/routertest_component_rest_api_enable
[ 98%] Built target routertest_component_rest_api_enable
[ 98%] Building CXX object router/tests/component/CMakeFiles/routertest_component_sd_notify.dir/test_sd_notify.cc.o
[ 98%] Linking CXX executable ../../../runtime_output_directory/routertest_component_sd_notify
[ 98%] Built target routertest_component_sd_notify
[100%] Building CXX object router/tests/component/CMakeFiles/routertest_component_rest_metadata_cache.dir/test_rest_metata_cache.cc.o
[100%] Linking CXX executable ../../../runtime_output_directory/routertest_component_rest_metadata_cache
[100%] Built target routertest_component_rest_metadata_cache
[100%] Building CXX object router/tests/component/CMakeFiles/routertest_component_rest_routing.dir/test_rest_routing.cc.
[100%] Linking CXX executable ../../../runtime_output_directory/routertest_component_rest_routing
[100%] Built target routertest_component_rest_routing
[100%] Building CXX object router/tests/component/rest_signal/src/CMakeFiles/rest_signal.dir/rest_signal_plugin.cc.o
[100%] Building CXX object router/tests/component/rest_signal/src/CMakeFiles/rest_signal.dir/rest_signal_abort.cc.o
[100%] Linking CXX shared library ../../../../../plugin_output_directory/rest_signal.so
[100%] Built target rest_signal
[100%] Building CXX object router/tests/integration/CMakeFiles/routertest_integration_routing_direct.dir/test_routing_dict.cc.o
[100%] Linking CXX executable ../../../runtime_output_directory/routertest_integration_routing_direct
[100%] Built target routertest_integration_routing_direct
[100%] Building CXX object router/tests/integration/CMakeFiles/routertest_integration_routing_reuse.dir/test_routing_reu.cc.o
[100%] Linking CXX executable ../../../runtime_output_directory/routertest_integration_routing_reuse
[100%] Built target routertest_integration_routing_reuse
[100%] Building CXX object router/tests/integration/CMakeFiles/routertest_integration_routing_sharing.dir/test_routing_sring.cc.o
[100%] Linking CXX executable ../../../runtime_output_directory/routertest_integration_routing_sharing
[100%] Built target routertest_integration_routing_sharing
[100%] Building CXX object router/tests/integration/CMakeFiles/routertest_integration_routing_sharing_constrained_pools.r/test_routing_sharing_constrained_pools.cc.o
[100%] Linking CXX executable ../../../runtime_output_directory/routertest_integration_routing_sharing_constrained_pools
[100%] Built target routertest_integration_routing_sharing_constrained_pools
[100%] Building CXX object router/tests/integration/CMakeFiles/routertest_integration_routing_sharing_restart.dir/test_rting_sharing_restart.cc.o
[100%] Linking CXX executable ../../../runtime_output_directory/routertest_integration_routing_sharing_restart
[100%] Built target routertest_integration_routing_sharing_restart
[root@192 bld]# make install
[  0%] Built target abi_check
Consolidate compiler generated dependencies of target zlib_objlib
[  1%] Built target zlib_objlib
[  1%] Built target zlib
Consolidate compiler generated dependencies of target libprotobuf
[  2%] Built target libprotobuf
Consolidate compiler generated dependencies of target libprotoc
[  4%] Built target libprotoc
Consolidate compiler generated dependencies of target protoc
[  5%] Built target protoc
Consolidate compiler generated dependencies of target rpl_protobuf_lite
[  5%] Built target rpl_protobuf_lite
Consolidate compiler generated dependencies of target lz4_lib
[  5%] Built target lz4_lib
Consolidate compiler generated dependencies of target zstd_objlib
[  6%] Built target zstd_objlib
[  6%] Built target zstd
Consolidate compiler generated dependencies of target event_pthreads
[root@192 bld]# cd /usr/local/mysql/
[root@192 mysql]# mkdir mysql-files
[root@192 mysql]# chown mysql:mysql mysql-files
[root@192 mysql]# chmod 750 mysql-files
# 临时密码在初始化时屏幕上有输出
[root@192 mysql]# ./bin/mysqld --initialize --user=mysql
2023-02-11T17:30:21.356408Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.32) initializing of server in progress as process 46939
2023-02-11T17:30:21.378025Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-02-11T17:30:22.324104Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-02-11T17:30:23.609467Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >k-Pqm=L6oXt
[root@192 mysql]# ./bin/mysql_ssl_rsa_setup
[root@192 mysql]# ./bin/mysqld_safe --user=mysql &
[2] 46983
[root@192 mysql]# Logging to '/usr/local/mysql/data/192.168.156.128.err'.
2023-02-11T17:31:20.436766Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2023-02-11T17:31:23.688169Z mysqld_safe mysqld from pid file /usr/local/mysql/data/192.168.156.128.pid ended

[2]+  已完成               ./bin/mysqld_safe --user=mysql
[root@192 mysql]# ./bin/mysql -uroot -p'>k-Pqm=L6oXt'
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 8
Server version: 8.0.32

Copyright (c) 2000, 2023, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!';
Query OK, 0 rows affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.11 sec)



你可能感兴趣的:(mysql,linux,数据库)