一、环境准备
1查看本机IP地址,使用Xshell工具登录
[root@mysql ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000link/ether 00:0c:29:89:e7:79 brd ff:ff:ff:ff:ff:ffinet 192.168.182.153/24 brd 192.168.182.255 scope global dynamic noprefixroute ens160valid_lft 1692sec preferred_lft 1692secinet 192.168.182.152/24 brd 192.168.182.255 scope global secondary noprefixroute ens160valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe89:e779/64 scope link noprefixroute valid_lft forever preferred_lft forever
2看操作系统版本
[root@mysql ~]# cat /etc/redhat-release
CentOS Linux release 8.5.2111
3关闭防火墙\selinux
[root@mysql ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: active (running) since Fri 2023-07-07 09:34:56 CST; 2min 46s agoDocs: man:firewalld(1)Main PID: 1136 (firewalld)Tasks: 2 (limit: 23500)Memory: 36.7MCGroup: /system.slice/firewalld.service└─1136 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopidJul 07 09:34:56 mysql systemd[1]: Starting firewalld - dynamic firewall daemon...
Jul 07 09:34:56 mysql systemd[1]: Started firewalld - dynamic firewall daemon.
Jul 07 09:34:56 mysql firewalld[1136]: WARNING: AllowZoneDrifting is enabled. This is considered an insecu>[root@mysql ~]# systemctl stop firewalld
[root@mysql ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: inactive (dead) since Fri 2023-07-07 09:38:02 CST; 2s agoDocs: man:firewalld(1)Process: 1136 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCC>Main PID: 1136 (code=exited, status=0/SUCCESS)Jul 07 09:34:56 mysql systemd[1]: Starting firewalld - dynamic firewall daemon...
Jul 07 09:34:56 mysql systemd[1]: Started firewalld - dynamic firewall daemon.
Jul 07 09:34:56 mysql firewalld[1136]: WARNING: AllowZoneDrifting is enabled. This is considered an insecu>
Jul 07 09:38:02 mysql systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jul 07 09:38:02 mysql systemd[1]: firewalld.service: Succeeded.
Jul 07 09:38:02 mysql systemd[1]: Stopped firewalld - dynamic firewall daemon.[root@mysql ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@mysql ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
4配置yum源
[root@mysql ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 9.0M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/cl-root xfs 33G 3.5G 29G 11% /
/dev/nvme0n1p1 xfs 4.0G 237M 3.8G 6% /boot
tmpfs tmpfs 371M 0 371M 0% /run/user/0[root@mysql ~]# yum -y install lrzsz
CentOS Linux 8 - AppStream 86 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
[root@mysql ~]# fdisk -l
Disk /dev/nvme0n1: 40 GiB, 42949672960 bytes, 83886080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc629c8c9Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 * 2048 8390655 8388608 4G 83 Linux
/dev/nvme0n1p2 8390656 83886079 75495424 36G 8e Linux LVMDisk /dev/mapper/cl-root: 32.1 GiB, 34422652928 bytes, 67231744 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/cl-swap: 4 GiB, 4227858432 bytes, 8257536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@mysql ~]#
[root@mysql ~]#
[root@mysql ~]#
[root@mysql ~]# ls
anaconda-ks.cfg
[root@mysql ~]#
5CentOS8网络 yum源配置、或本地yum源
[root@mysql ~]# cd /etc/yum.repos.d/
[root@mysql yum.repos.d]# ls
CentOS-Linux-AppStream.repo CentOS-Linux-Devel.repo CentOS-Linux-Media.repo
CentOS-Linux-BaseOS.repo CentOS-Linux-Extras.repo CentOS-Linux-Plus.repo
CentOS-Linux-ContinuousRelease.repo CentOS-Linux-FastTrack.repo CentOS-Linux-PowerTools.repo
CentOS-Linux-Debuginfo.repo CentOS-Linux-HighAvailability.repo CentOS-Linux-Sources.repo
[root@mysql yum.repos.d]# mv CentOS-Linux-AppStream.repo CentOS-Linux-AppStream.repo.bak
[root@mysql yum.repos.d]# mv CentOS-Linux-BaseOS.repo CentOS-Linux-BaseOS.repo.bak
[root@mysql yum.repos.d]# ll
total 48
-rw-r--r--. 1 root root 719 Sep 15 2021 CentOS-Linux-AppStream.repo.bak
-rw-r--r--. 1 root root 704 Sep 15 2021 CentOS-Linux-BaseOS.repo.bak
-rw-r--r--. 1 root root 1130 Sep 15 2021 CentOS-Linux-ContinuousRelease.repo
-rw-r--r--. 1 root root 318 Sep 15 2021 CentOS-Linux-Debuginfo.repo
-rw-r--r--. 1 root root 732 Sep 15 2021 CentOS-Linux-Devel.repo
-rw-r--r--. 1 root root 704 Sep 15 2021 CentOS-Linux-Extras.repo
-rw-r--r--. 1 root root 719 Sep 15 2021 CentOS-Linux-FastTrack.repo
-rw-r--r--. 1 root root 740 Sep 15 2021 CentOS-Linux-HighAvailability.repo
-rw-r--r--. 1 root root 693 Sep 15 2021 CentOS-Linux-Media.repo
-rw-r--r--. 1 root root 706 Sep 15 2021 CentOS-Linux-Plus.repo
-rw-r--r--. 1 root root 724 Sep 15 2021 CentOS-Linux-PowerTools.repo
-rw-r--r--. 1 root root 1124 Sep 15 2021 CentOS-Linux-Sources.repo```c## 6使用vim(没有用vi)命令创建然后编辑yum源配置文件```c[root@mysql yum.repos.d]# vi wlyum.repo
[root@mysql yum.repos.d]# ls
CentOS-Linux-AppStream.repo.bak CentOS-Linux-Extras.repo CentOS-Linux-PowerTools.repo
CentOS-Linux-BaseOS.repo.bak CentOS-Linux-FastTrack.repo CentOS-Linux-Sources.repo
CentOS-Linux-ContinuousRelease.repo CentOS-Linux-HighAvailability.repo wlyum.repo
CentOS-Linux-Debuginfo.repo CentOS-Linux-Media.repo
CentOS-Linux-Devel.repo CentOS-Linux-Plus.repo
[root@mysql yum.repos.d]# mkdir /tmp/yum.repos
[root@mysql yum.repos.d]# mv CentOS-Linux-* /tmp/yum.repos/
[root@mysql yum.repos.d]# ls
wlyum.repo[root@mysql yum.repos.d]# cat wlyum.repo
[base]
name=CentOS-8-stream - Base - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official#additional packages that may be useful
[extras]
name=CentOS-8-stream - Extras - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/extras/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-8-stream - Plus - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official[PowerTools]
name=CentOS-8-stream - PowerTools - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official[AppStream]
name=CentOS-8-stream - AppStream - mirrors.aliyun.com
baseurl=https://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
7配置好后使用yum clean all命令删除原有的数据缓存、重新建立数据缓存
[root@mysql yum.repos.d]# yum clean all
0 files removed
[root@mysql yum.repos.d]# ls
wlyum.repo
[root@mysql yum.repos.d]# vi wlyum.repo CentOS-Base.repo
2 files to edit
[root@mysql yum.repos.d]# mv wlyum.repo CentOS-Base.repo
[root@mysql yum.repos.d]# ls
CentOS-Base.repo
[root@mysql yum.repos.d]# yum clean all
0 files removed
[root@mysql yum.repos.d]# yum makecache
CentOS-8-stream - Base - mirrors.aliyun.com 754 kB/s | 41 MB 00:55
CentOS-8-stream - Extras - mirrors.aliyun.com 46 kB/s | 18 kB 00:00
CentOS-8-stream - AppStream - mirrors.aliyun.com 527 kB/s | 31 MB 00:59
Metadata cache created.
8安装依赖包
[root@mysql yum.repos.d]# yum install -y lrzsz wget perl-Digest-MD5
Last metadata expiration check: 0:01:35 ago on Fri 07 Jul 2023 10:00:24 AM CST.
Package perl-Digest-MD5-2.55-396.el8.x86_64 is already installed.
Dependencies resolved.
===========================================================================================================Package Architecture Version Repository Size
===========================================================================================================
Installing:lrzsz x86_64 0.12.20-43.el8 base 84 kwget x86_64 1.19.5-11.el8 AppStream 734 k
Installing dependencies:libmetalink x86_64 0.1.3-7.el8 base 32 kTransaction Summary
===========================================================================================================
Install 3 PackagesTotal download size: 850 k
Installed size: 3.0 M
Downloading Packages:
(1/3): libmetalink-0.1.3-7.el8.x86_64.rpm 64 kB/s | 32 kB 00:00
(2/3): lrzsz-0.12.20-43.el8.x86_64.rpm 155 kB/s | 84 kB 00:00
(3/3): wget-1.19.5-11.el8.x86_64.rpm 384 kB/s | 734 kB 00:01
-----------------------------------------------------------------------------------------------------------
Total 443 kB/s | 850 kB 00:01
CentOS-8-stream - Base - mirrors.aliyun.com 9.3 kB/s | 1.6 kB 00:00
Importing GPG key 0x8483C65D:Userid : "CentOS (CentOS Official Signing Key) <security@centos.org>"Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65DFrom : https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Installing : libmetalink-0.1.3-7.el8.x86_64 1/3 Installing : wget-1.19.5-11.el8.x86_64 2/3 Running scriptlet: wget-1.19.5-11.el8.x86_64 2/3 Installing : lrzsz-0.12.20-43.el8.x86_64 3/3 Running scriptlet: lrzsz-0.12.20-43.el8.x86_64 3/3 Verifying : libmetalink-0.1.3-7.el8.x86_64 1/3 Verifying : lrzsz-0.12.20-43.el8.x86_64 2/3 Verifying : wget-1.19.5-11.el8.x86_64 3/3 Installed:libmetalink-0.1.3-7.el8.x86_64 lrzsz-0.12.20-43.el8.x86_64 wget-1.19.5-11.el8.x86_64 Complete!
[root@mysql yum.repos.d]#
9安装依赖包ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make
[root@mysql yum.repos.d]# yum -y install numactl
Last metadata expiration check: 0:08:29 ago on Fri 07 Jul 2023 10:00:24 AM CST.
Dependencies resolved.
===========================================================================================================Package Architecture Version Repository Size
===========================================================================================================
Installing:numactl x86_64 2.0.12-13.el8 base 76 kTransaction Summary
===========================================================================================================
Install 1 PackageTotal download size: 76 k
Installed size: 161 k
Downloading Packages:
numactl-2.0.12-13.el8.x86_64.rpm 203 kB/s | 76 kB 00:00
-----------------------------------------------------------------------------------------------------------
Total 202 kB/s | 76 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Installing : numactl-2.0.12-13.el8.x86_64 1/1 Running scriptlet: numactl-2.0.12-13.el8.x86_64 1/1 Verifying : numactl-2.0.12-13.el8.x86_64 1/1 Installed:numactl-2.0.12-13.el8.x86_64 Complete!
[root@mysql yum.repos.d]# yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make
Last metadata expiration check: 0:09:42 ago on Fri 07 Jul 2023 10:00:24 AM CST.
Package ncurses-6.1-9.20180224.el8.x86_64 is already installed.
Package bison-3.0.4-10.el8.x86_64 is already installed.
Package gcc-8.5.0-3.el8.x86_64 is already installed.
Package gcc-c++-8.5.0-3.el8.x86_64 is already installed.
Package make-1:4.2.1-10.el8.x86_64 is already installed.
Dependencies resolved.
===========================================================================================================Package Architecture Version Repository Size
===========================================================================================================
Installing:ncurses-devel x86_64 6.1-9.20180224.el8 base 528 kopenssl-devel x86_64 1:1.1.1k-9.el8 base 3.2 M
Upgrading:cpp x86_64 8.5.0-20.el8 base 10 Mgcc x86_64 8.5.0-20.el8 base 24 Mgcc-c++ x86_64 8.5.0-20.el8 AppStream 12 Mgcc-gdb-plugin x86_64 8.5.0-20.el8 AppStream 121 klibgcc x86_64 8.5.0-20.el8 base 81 klibgomp x86_64 8.5.0-20.el8 base 208 klibstdc++ x86_64 8.5.0-20.el8 base 458 klibstdc++-devel x86_64 8.5.0-20.el8 AppStream 2.2 Mmake x86_64 1:4.2.1-11.el8 base 498 kopenssl x86_64 1:1.1.1k-9.el8 base 737 kopenssl-libs x86_64 1:1.1.1k-9.el8 base 1.5 M
Installing dependencies:keyutils-libs-devel x86_64 1.5.10-9.el8 base 48 kkrb5-devel x86_64 1.18.2-14.el8 base 560 klibcom_err-devel x86_64 1.45.6-2.el8 base 38 klibkadm5 x86_64 1.18.2-14.el8 base 187 klibselinux-devel x86_64 2.9-5.el8 base 200 klibsepol-devel x86_64 2.9-3.el8 base 87 klibverto-devel x86_64 0.3.0-5.el8 base 18 kncurses-c++-libs x86_64 6.1-9.20180224.el8 base 58 kpcre2-devel x86_64 10.32-2.el8 base 605 kpcre2-utf16 x86_64 10.32-2.el8 base 229 kpcre2-utf32 x86_64 10.32-2.el8 base 220 kTransaction Summary
===========================================================================================================
Install 13 Packages
Upgrade 11 PackagesTotal download size: 58 M
Downloading Packages:
(1/24): keyutils-libs-devel-1.5.10-9.el8.x86_64.rpm 189 kB/s | 48 kB 00:00
(2/24): libcom_err-devel-1.45.6-2.el8.x86_64.rpm 100 kB/s | 38 kB 00:00
(3/24): libkadm5-1.18.2-14.el8.x86_64.rpm 345 kB/s | 187 kB 00:00
(4/24): libsepol-devel-2.9-3.el8.x86_64.rpm 371 kB/s | 87 kB 00:00
(5/24): libselinux-devel-2.9-5.el8.x86_64.rpm 296 kB/s | 200 kB 00:00
(6/24): libverto-devel-0.3.0-5.el8.x86_64.rpm 92 kB/s | 18 kB 00:00
(7/24): ncurses-c++-libs-6.1-9.20180224.el8.x86_64.rpm 194 kB/s | 58 kB 00:00
(8/24): krb5-devel-1.18.2-14.el8.x86_64.rpm 349 kB/s | 560 kB 00:01
(9/24): ncurses-devel-6.1-9.20180224.el8.x86_64.rpm 411 kB/s | 528 kB 00:01
(10/24): pcre2-utf16-10.32-2.el8.x86_64.rpm 371 kB/s | 229 kB 00:00
(11/24): pcre2-devel-10.32-2.el8.x86_64.rpm 390 kB/s | 605 kB 00:01
(12/24): pcre2-utf32-10.32-2.el8.x86_64.rpm 368 kB/s | 220 kB 00:00
(13/24): openssl-devel-1.1.1k-9.el8.x86_64.rpm 398 kB/s | 3.2 MB 00:08
(14/24): libgcc-8.5.0-20.el8.x86_64.rpm 284 kB/s | 81 kB 00:00
(15/24): libgomp-8.5.0-20.el8.x86_64.rpm 361 kB/s | 208 kB 00:00
(16/24): libstdc++-8.5.0-20.el8.x86_64.rpm 379 kB/s | 458 kB 00:01
(17/24): make-4.2.1-11.el8.x86_64.rpm 372 kB/s | 498 kB 00:01
(18/24): openssl-1.1.1k-9.el8.x86_64.rpm 380 kB/s | 737 kB 00:01
(19/24): openssl-libs-1.1.1k-9.el8.x86_64.rpm 362 kB/s | 1.5 MB 00:04
(20/24): cpp-8.5.0-20.el8.x86_64.rpm 400 kB/s | 10 MB 00:26
(21/24): gcc-gdb-plugin-8.5.0-20.el8.x86_64.rpm 287 kB/s | 121 kB 00:00
(22/24): libstdc++-devel-8.5.0-20.el8.x86_64.rpm 405 kB/s | 2.2 MB 00:05
(23/24): gcc-c++-8.5.0-20.el8.x86_64.rpm 379 kB/s | 12 MB 00:33
(24/24): gcc-8.5.0-20.el8.x86_64.rpm 421 kB/s | 24 MB 00:57
-----------------------------------------------------------------------------------------------------------
Total 973 kB/s | 58 MB 01:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Upgrading : openssl-libs-1:1.1.1k-9.el8.x86_64 1/35 Running scriptlet: openssl-libs-1:1.1.1k-9.el8.x86_64 1/35 Upgrading : libgcc-8.5.0-20.el8.x86_64 2/35 Running scriptlet: libgcc-8.5.0-20.el8.x86_64 2/35 Upgrading : libstdc++-8.5.0-20.el8.x86_64 3/35 Running scriptlet: libstdc++-8.5.0-20.el8.x86_64 3/35 Installing : ncurses-c++-libs-6.1-9.20180224.el8.x86_64 4/35 Upgrading : libstdc++-devel-8.5.0-20.el8.x86_64 5/35 Installing : libkadm5-1.18.2-14.el8.x86_64 6/35 Upgrading : libgomp-8.5.0-20.el8.x86_64 7/35 Running scriptlet: libgomp-8.5.0-20.el8.x86_64 7/35 Upgrading : cpp-8.5.0-20.el8.x86_64 8/35 Running scriptlet: cpp-8.5.0-20.el8.x86_64 8/35 Upgrading : gcc-8.5.0-20.el8.x86_64 9/35 Running scriptlet: gcc-8.5.0-20.el8.x86_64 9/35 Installing : pcre2-utf32-10.32-2.el8.x86_64 10/35 Installing : pcre2-utf16-10.32-2.el8.x86_64 11/35 Installing : pcre2-devel-10.32-2.el8.x86_64 12/35 Installing : libverto-devel-0.3.0-5.el8.x86_64 13/35 Installing : libsepol-devel-2.9-3.el8.x86_64 14/35 Installing : libselinux-devel-2.9-5.el8.x86_64 15/35 Installing : libcom_err-devel-1.45.6-2.el8.x86_64 16/35 Installing : keyutils-libs-devel-1.5.10-9.el8.x86_64 17/35 Installing : krb5-devel-1.18.2-14.el8.x86_64 18/35 Installing : openssl-devel-1:1.1.1k-9.el8.x86_64 19/35 Upgrading : gcc-c++-8.5.0-20.el8.x86_64 20/35 Upgrading : gcc-gdb-plugin-8.5.0-20.el8.x86_64 21/35 Running scriptlet: gcc-gdb-plugin-8.5.0-20.el8.x86_64 21/35 Installing : ncurses-devel-6.1-9.20180224.el8.x86_64 22/35 Upgrading : openssl-1:1.1.1k-9.el8.x86_64 23/35 Upgrading : make-1:4.2.1-11.el8.x86_64 24/35 Running scriptlet: make-1:4.2.1-11.el8.x86_64 24/35 Cleanup : gcc-gdb-plugin-8.5.0-3.el8.x86_64 25/35 Running scriptlet: gcc-gdb-plugin-8.5.0-3.el8.x86_64 25/35 Cleanup : openssl-1:1.1.1k-4.el8.x86_64 26/35 Cleanup : gcc-c++-8.5.0-3.el8.x86_64 27/35 Cleanup : libstdc++-devel-8.5.0-3.el8.x86_64 28/35 Cleanup : libstdc++-8.5.0-3.el8.x86_64 29/35 Running scriptlet: libstdc++-8.5.0-3.el8.x86_64 29/35 Running scriptlet: gcc-8.5.0-3.el8.x86_64 30/35 Cleanup : gcc-8.5.0-3.el8.x86_64 30/35 Running scriptlet: cpp-8.5.0-3.el8.x86_64 31/35 Cleanup : cpp-8.5.0-3.el8.x86_64 31/35 Cleanup : libgcc-8.5.0-3.el8.x86_64 32/35 Running scriptlet: libgcc-8.5.0-3.el8.x86_64 32/35 Running scriptlet: libgomp-8.5.0-3.el8.x86_64 33/35 Cleanup : libgomp-8.5.0-3.el8.x86_64 33/35 Running scriptlet: libgomp-8.5.0-3.el8.x86_64 33/35 Cleanup : openssl-libs-1:1.1.1k-4.el8.x86_64 34/35 Running scriptlet: openssl-libs-1:1.1.1k-4.el8.x86_64 34/35 Running scriptlet: make-1:4.2.1-10.el8.x86_64 35/35 Cleanup : make-1:4.2.1-10.el8.x86_64 35/35 Running scriptlet: make-1:4.2.1-10.el8.x86_64 35/35 Verifying : keyutils-libs-devel-1.5.10-9.el8.x86_64 1/35 Verifying : krb5-devel-1.18.2-14.el8.x86_64 2/35 Verifying : libcom_err-devel-1.45.6-2.el8.x86_64 3/35 Verifying : libkadm5-1.18.2-14.el8.x86_64 4/35 Verifying : libselinux-devel-2.9-5.el8.x86_64 5/35 Verifying : libsepol-devel-2.9-3.el8.x86_64 6/35 Verifying : libverto-devel-0.3.0-5.el8.x86_64 7/35 Verifying : ncurses-c++-libs-6.1-9.20180224.el8.x86_64 8/35 Verifying : ncurses-devel-6.1-9.20180224.el8.x86_64 9/35 Verifying : openssl-devel-1:1.1.1k-9.el8.x86_64 10/35 Verifying : pcre2-devel-10.32-2.el8.x86_64 11/35 Verifying : pcre2-utf16-10.32-2.el8.x86_64 12/35 Verifying : pcre2-utf32-10.32-2.el8.x86_64 13/35 Verifying : cpp-8.5.0-20.el8.x86_64 14/35 Verifying : cpp-8.5.0-3.el8.x86_64 15/35 Verifying : gcc-8.5.0-20.el8.x86_64 16/35 Verifying : gcc-8.5.0-3.el8.x86_64 17/35 Verifying : libgcc-8.5.0-20.el8.x86_64 18/35 Verifying : libgcc-8.5.0-3.el8.x86_64 19/35 Verifying : libgomp-8.5.0-20.el8.x86_64 20/35 Verifying : libgomp-8.5.0-3.el8.x86_64 21/35 Verifying : libstdc++-8.5.0-20.el8.x86_64 22/35 Verifying : libstdc++-8.5.0-3.el8.x86_64 23/35 Verifying : make-1:4.2.1-11.el8.x86_64 24/35 Verifying : make-1:4.2.1-10.el8.x86_64 25/35 Verifying : openssl-1:1.1.1k-9.el8.x86_64 26/35 Verifying : openssl-1:1.1.1k-4.el8.x86_64 27/35 Verifying : openssl-libs-1:1.1.1k-9.el8.x86_64 28/35 Verifying : openssl-libs-1:1.1.1k-4.el8.x86_64 29/35 Verifying : gcc-c++-8.5.0-20.el8.x86_64 30/35 Verifying : gcc-c++-8.5.0-3.el8.x86_64 31/35 Verifying : gcc-gdb-plugin-8.5.0-20.el8.x86_64 32/35 Verifying : gcc-gdb-plugin-8.5.0-3.el8.x86_64 33/35 Verifying : libstdc++-devel-8.5.0-20.el8.x86_64 34/35 Verifying : libstdc++-devel-8.5.0-3.el8.x86_64 35/35 Upgraded:cpp-8.5.0-20.el8.x86_64 gcc-8.5.0-20.el8.x86_64 gcc-c++-8.5.0-20.el8.x86_64 gcc-gdb-plugin-8.5.0-20.el8.x86_64 libgcc-8.5.0-20.el8.x86_64 libgomp-8.5.0-20.el8.x86_64 libstdc++-8.5.0-20.el8.x86_64 libstdc++-devel-8.5.0-20.el8.x86_64 make-1:4.2.1-11.el8.x86_64 openssl-1:1.1.1k-9.el8.x86_64 openssl-libs-1:1.1.1k-9.el8.x86_64
Installed:keyutils-libs-devel-1.5.10-9.el8.x86_64 krb5-devel-1.18.2-14.el8.x86_64 libcom_err-devel-1.45.6-2.el8.x86_64 libkadm5-1.18.2-14.el8.x86_64 libselinux-devel-2.9-5.el8.x86_64 libsepol-devel-2.9-3.el8.x86_64 libverto-devel-0.3.0-5.el8.x86_64 ncurses-c++-libs-6.1-9.20180224.el8.x86_64 ncurses-devel-6.1-9.20180224.el8.x86_64 openssl-devel-1:1.1.1k-9.el8.x86_64 pcre2-devel-10.32-2.el8.x86_64 pcre2-utf16-10.32-2.el8.x86_64 pcre2-utf32-10.32-2.el8.x86_64 Complete!
[root@mysql yum.repos.d]#
10添加用户和组
[root@mysql yum.repos.d]# groupadd mysql
[root@mysql yum.repos.d]# tail -n 2 /etc/group //查看组信息
sshd:x:74:
mysql:x:1000:
[root@mysql yum.repos.d]# groupdel mysql //删除组信息,如果租内有用户,那么必须先删除用户。
[root@mysql yum.repos.d]# groupadd mysql -g 999
groupadd: GID '999' already exists
[root@mysql yum.repos.d]# groupadd mysql -g 789 //创建组,指定id
[root@mysql yum.repos.d]# useradd -g mysql -d /home/mysql mysql
[root@mysql yum.repos.d]# passwd mysql //修改密码
Changing password for user mysql.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
Sorry, passwords do not match.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@mysql yum.repos.d]#
二、上传rpm包,安装mysql
1也可通过wget直接下载安装
[root@mysql yum.repos.d]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
--2023-07-07 10:25:33-- https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
Resolving cdn.mysql.com (cdn.mysql.com)... 184.25.232.250
Connecting to cdn.mysql.com (cdn.mysql.com)|184.25.232.250|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1027983360 (980M) [application/x-tar]
Saving to: ‘mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar’mysql-8.0.33-1.el7.x86_64. 100%[=======================================>] 980.36M 6.11MB/s in 3m 5s 2023-07-07 10:28:39 (5.29 MB/s) - ‘mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar’ saved [1027983360/1027983360][root@mysql yum.repos.d]# ls
CentOS-Base.repo mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
[root@mysql yum.repos.d]# mv mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar /home/mysql/
[root@mysql yum.repos.d]# ls
CentOS-Base.repo
[root@mysql yum.repos.d]# cd /home/mysql/
[root@mysql mysql]# ls
mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
2检验安装包
[root@mysql mysql]# md5sum mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
46ff46ecd34b48e3adc992e219aa8cb3 mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
解压安装包
[root@mysql mysql]# tar -xvf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.33-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
mysql-community-common-8.0.33-1.el7.x86_64.rpm
mysql-community-debuginfo-8.0.33-1.el7.x86_64.rpm
mysql-community-devel-8.0.33-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.33-1.el7.x86_64.rpm
mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
mysql-community-libs-8.0.33-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
mysql-community-server-8.0.33-1.el7.x86_64.rpm
mysql-community-server-debug-8.0.33-1.el7.x86_64.rpm
mysql-community-test-8.0.33-1.el7.x86_64.rpm
[root@mysql mysql]# chown -R mysql:mysql /home/mysql/
[root@mysql mysql]# ll
total 2007792
-rw-r--r-- 1 mysql mysql 1027983360 Mar 17 17:39 mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 mysql mysql 16972740 Mar 17 17:28 mysql-community-client-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 3746004 Mar 17 17:28 mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 680276 Mar 17 17:28 mysql-community-common-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 524492024 Mar 17 17:29 mysql-community-debuginfo-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 1969188 Mar 17 17:29 mysql-community-devel-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 4218852 Mar 17 17:29 mysql-community-embedded-compat-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 2219168 Mar 17 17:29 mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 1587536 Mar 17 17:29 mysql-community-libs-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 686272 Mar 17 17:29 mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 67412732 Mar 17 17:30 mysql-community-server-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 25518376 Mar 17 17:30 mysql-community-server-debug-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 mysql mysql 378469824 Mar 17 17:32 mysql-community-test-8.0.33-1.el7.x86_64.rpm
安装
只需要 四个基本包安装
rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64 \
rpm -ivh --force --nodeps mysql-community-libs-8.0.33-1.el7.x86_64
rpm -ivh --force --nodeps mysql-community-client-8.0.33-1.el7.x86_64
rpm -ivh --force --nodeps mysql-community-server-8.0.33-1.el7.x86_64
这里多选择几个包完全安装
[root@mysql mysql]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm \
> mysql-community-libs-8.0.33-1.el7.x86_64.rpm \
> mysql-community-client-8.0.33-1.el7.x86_64.rpm \
> mysql-community-server-8.0.33-1.el7.x86_64.rpm \
> mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm \
> mysql-community-devel-8.0.33-1.el7.x86_64.rpm \
> mysql-community-test-8.0.33-1.el7.x86_64.rpm
错误:依赖检测失败:perl(JSON) 被 mysql-community-test-8.0.17-1.el7.x86_64 需要
因为缺少perl-JSON依赖包.
[root@mysql mysql]# yum list |grep "perl-JSON"
perl-JSON.noarch 2.97.001-2.el8 @AppStream
perl-JSON-PP.noarch 1:2.97.001-3.el8 @AppStream
[root@mysql mysql]# yum install -y perl-JSON*
4再次安装
[root@mysql mysql]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm mysql-community-libs-8.0.33-1.el7.x86_64.rpm mysql-community-client-8.0.33-1.el7.x86_64.rpm mysql-community-server-8.0.33-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm mysql-community-devel-8.0.33-1.el7.x86_64.rpm mysql-community-test-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:libcrypto.so.10()(64bit) is needed by mysql-community-libs-8.0.33-1.el7.x86_64libcrypto.so.10(libcrypto.so.10)(64bit) is needed by mysql-community-libs-8.0.33-1.el7.x86_64libssl.so.10()(64bit) is needed by mysql-community-libs-8.0.33-1.el7.x86_64libssl.so.10(libssl.so.10)(64bit) is needed by mysql-community-libs-8.0.33-1.el7.x86_64mysql-community-client-plugins = 8.0.33-1.el7 is needed by mysql-community-libs-8.0.33-1.el7.x86_64libcrypto.so.10()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64libcrypto.so.10(libcrypto.so.10)(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64libncurses.so.5()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64libssl.so.10()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64libssl.so.10(libssl.so.10)(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64libtinfo.so.5()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64mysql-community-client-plugins = 8.0.33-1.el7 is needed by mysql-community-client-8.0.33-1.el7.x86_64libcrypto.so.10()(64bit) is needed by mysql-community-server-8.0.33-1.el7.x86_64libcrypto.so.10(OPENSSL_1.0.2)(64bit) is needed by mysql-community-server-8.0.33-1.el7.x86_64libcrypto.so.10(libcrypto.so.10)(64bit) is needed by mysql-community-server-8.0.33-1.el7.x86_64libssl.so.10()(64bit) is needed by mysql-community-server-8.0.33-1.el7.x86_64libssl.so.10(libssl.so.10)(64bit) is needed by mysql-community-server-8.0.33-1.el7.x86_64mysql-community-icu-data-files = 8.0.33-1.el7 is needed by mysql-community-server-8.0.33-1.el7.x86_64net-tools is needed by mysql-community-server-8.0.33-1.el7.x86_64mariadb-connector-c-config is obsoleted by mysql-community-server-8.0.33-1.el7.x86_64libcrypto.so.10()(64bit) is needed by mysql-community-libs-compat-8.0.33-1.el7.x86_64libcrypto.so.10(libcrypto.so.10)(64bit) is needed by mysql-community-libs-compat-8.0.33-1.el7.x86_64libssl.so.10()(64bit) is needed by mysql-community-libs-compat-8.0.33-1.el7.x86_64libssl.so.10(libssl.so.10)(64bit) is needed by mysql-community-libs-compat-8.0.33-1.el7.x86_64libcrypto.so.10()(64bit) is needed by mysql-community-test-8.0.33-1.el7.x86_64libcrypto.so.10(libcrypto.so.10)(64bit) is needed by mysql-community-test-8.0.33-1.el7.x86_64libssl.so.10()(64bit) is needed by mysql-community-test-8.0.33-1.el7.x86_64libssl.so.10(libssl.so.10)(64bit) is needed by mysql-community-test-8.0.33-1.el7.x86_64
[root@mysql mysql]#
5解决方法一:
安装rpm -ivh mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm命令后加参数: --nodeps --force
方法二:查看库文件:
[root@mysql mysql]# ll /usr/lib64/libcrypto.so*
lrwxrwxrwx 1 root root 19 Feb 18 09:38 /usr/lib64/libcrypto.so -> libcrypto.so.1.1.1k
lrwxrwxrwx 1 root root 19 Feb 18 09:38 /usr/lib64/libcrypto.so.1.1 -> libcrypto.so.1.1.1k
-rwxr-xr-x 1 root root 3083608 Feb 18 09:38 /usr/lib64/libcrypto.so.1.1.1k
下载安装文件compat-openssl10-1.0.2o-3.el8.x86_64.rpm
执行安装命令: rpm -ivh compat-openssl10-1.0.2o-3.el8.x86_64.rpm
[root@mysql mysql]# yum install -y compat-openssl10-1.0.2o-3.el8.x86_64.rpm
Last metadata expiration check: 0:13:44 ago on Fri 07 Jul 2023 10:36:08 AM CST.
Can not load RPM file: compat-openssl10-1.0.2o-3.el8.x86_64.rpm.
Could not open: compat-openssl10-1.0.2o-3.el8.x86_64.rpm
[root@mysql mysql]# yum install -y compat-openssl10-1.0.2o-3
Last metadata expiration check: 0:13:58 ago on Fri 07 Jul 2023 10:36:08 AM CST.
No match for argument: compat-openssl10-1.0.2o-3
Error: Unable to find a match: compat-openssl10-1.0.2o-3
[root@mysql mysql]# yum install -y compat-openssl10-1.0.*
Last metadata expiration check: 0:14:07 ago on Fri 07 Jul 2023 10:36:08 AM CST.
Dependencies resolved.
===========================================================================================================Package Architecture Version Repository Size
===========================================================================================================
Installing:compat-openssl10 x86_64 1:1.0.2o-4.el8 AppStream 1.1 MTransaction Summary
===========================================================================================================
Install 1 PackageTotal download size: 1.1 M
Installed size: 2.9 M
Downloading Packages:
compat-openssl10-1.0.2o-4.el8.x86_64.rpm 280 kB/s | 1.1 MB 00:04
-----------------------------------------------------------------------------------------------------------
Total 280 kB/s | 1.1 MB 00:04
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Installing : compat-openssl10-1:1.0.2o-4.el8.x86_64 1/1 Running scriptlet: compat-openssl10-1:1.0.2o-4.el8.x86_64 1/1
/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic link/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic linkVerifying : compat-openssl10-1:1.0.2o-4.el8.x86_64 1/1 Installed:compat-openssl10-1:1.0.2o-4.el8.x86_64 Complete!
[root@mysql mysql]#
6再次安装mysql包
[root@mysql mysql]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm mysql-community-libs-8.0.33-1.el7.x86_64.rpm mysql-community-client-8.0.33-1.el7.x86_64.rpm mysql-community-server-8.0.33-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm mysql-community-devel-8.0.33-1.el7.x86_64.rpm mysql-community-test-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:mysql-community-client-plugins = 8.0.33-1.el7 is needed by mysql-community-libs-8.0.33-1.el7.x86_64libncurses.so.5()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64libtinfo.so.5()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64mysql-community-client-plugins = 8.0.33-1.el7 is needed by mysql-community-client-8.0.33-1.el7.x86_64mysql-community-icu-data-files = 8.0.33-1.el7 is needed by mysql-community-server-8.0.33-1.el7.x86_64net-tools is needed by mysql-community-server-8.0.33-1.el7.x86_64mariadb-connector-c-config is obsoleted by mysql-community-server-8.0.33-1.el7.x86_64
[root@mysql mysql]#
[root@mysql mysql]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm mysql-community-libs-8.0.33-1.el7.x86_64.rpm mysql-community-client-8.0.33-1.el7.x86_64.rpm mysql-community-server-8.0.33-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm mysql-community-devel-8.0.33-1.el7.x86_64.rpm mysql-community-test-8.0.33-1.el7.x86_64.rpm mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:libncurses.so.5()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64libtinfo.so.5()(64bit) is needed by mysql-community-client-8.0.33-1.el7.x86_64net-tools is needed by mysql-community-server-8.0.33-1.el7.x86_64mariadb-connector-c-config is obsoleted by mysql-community-server-8.0.33-1.el7.x86_64
7centOS8 安装mysql 报 libncurses.so.5()(64bit) is needed by MySQL-client
[root@mysql mysql]# yum install libncurses*
Last metadata expiration check: 0:21:54 ago on Fri 07 Jul 2023 10:36:08 AM CST.
Package ncurses-c++-libs-6.1-9.20180224.el8.x86_64 is already installed.
Package ncurses-libs-6.1-9.20180224.el8.x86_64 is already installed.
Dependencies resolved.
===========================================================================================================Package Architecture Version Repository Size
===========================================================================================================
Installing:ncurses-compat-libs x86_64 6.1-9.20180224.el8 base 328 kTransaction Summary
===========================================================================================================
Install 1 PackageTotal download size: 328 k
Installed size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
ncurses-compat-libs-6.1-9.20180224.el8.x86_64.rpm 265 kB/s | 328 kB 00:01
-----------------------------------------------------------------------------------------------------------
Total 265 kB/s | 328 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Installing : ncurses-compat-libs-6.1-9.20180224.el8.x86_64 1/1 Running scriptlet: ncurses-compat-libs-6.1-9.20180224.el8.x86_64 1/1
/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic linkVerifying : ncurses-compat-libs-6.1-9.20180224.el8.x86_64 1/1 Installed:ncurses-compat-libs-6.1-9.20180224.el8.x86_64 Complete!
[root@mysql mysql]# [root@mysql mysql]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm mysql-community-libs-8.0.33-1.el7.x86_64.rpm mysql-community-client-8.0.33-1.el7.x86_64.rpm mysql-community-server-8.0.33-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm mysql-community-devel-8.0.33-1.el7.x86_64.rpm mysql-community-test-8.0.33-1.el7.x86_64.rpm mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:net-tools is needed by mysql-community-server-8.0.33-1.el7.x86_64mariadb-connector-c-config is obsoleted by mysql-community-server-8.0.33-1.el7.x86_64
[root@mysql mysql]#
解决办法
[root@mysql mysql]# yum remove mariadb-connector-c-config
Dependencies resolved.
===========================================================================================================Package Arch Version Repository Size
===========================================================================================================
Removing:mariadb-connector-c-config noarch 3.1.11-2.el8_3 @AppStream 497
Removing dependent packages:perl-DBD-MySQL x86_64 4.046-3.module_el8.3.0+419+c2dec72b @AppStream 358 k
Removing unused dependencies:mariadb-connector-c x86_64 3.1.11-2.el8_3 @AppStream 509 kTransaction Summary
===========================================================================================================
Remove 3 PackagesFreed space: 868 k
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Erasing : perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64 1/3 Erasing : mariadb-connector-c-3.1.11-2.el8_3.x86_64 2/3 Erasing : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 3/3 Running scriptlet: mariadb-connector-c-config-3.1.11-2.el8_3.noarch 3/3
/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic linkVerifying : mariadb-connector-c-3.1.11-2.el8_3.x86_64 1/3 Verifying : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 2/3 Verifying : perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64 3/3 Removed:mariadb-connector-c-3.1.11-2.el8_3.x86_64 mariadb-connector-c-config-3.1.11-2.el8_3.noarch perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64 Complete!
[root@mysql mysql]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm mysql-community-libs-8.0.33-1.el7.x86_64.rpm mysql-community-client-8.0.33-1.el7.x86_64.rpm mysql-community-server-8.0.33-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm mysql-community-devel-8.0.33-1.el7.x86_64.rpm mysql-community-test-8.0.33-1.el7.x86_64.rpm mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
[root@mysql mysql]# yum install -y net-tools
Last metadata expiration check: 0:30:09 ago on Fri 07 Jul 2023 10:36:08 AM CST.
Dependencies resolved.
===========================================================================================================Package Architecture Version Repository Size
===========================================================================================================
Installing:net-tools x86_64 2.0-0.52.20160912git.el8 base 322 kTransaction Summary
===========================================================================================================
Install 1 PackageTotal download size: 322 k
Installed size: 942 k
Downloading Packages:
net-tools-2.0-0.52.20160912git.el8.x86_64.rpm 262 kB/s | 322 kB 00:01
-----------------------------------------------------------------------------------------------------------
Total 262 kB/s | 322 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing : 1/1 Installing : net-tools-2.0-0.52.20160912git.el8.x86_64 1/1 Running scriptlet: net-tools-2.0-0.52.20160912git.el8.x86_64 1/1
/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic linkVerifying : net-tools-2.0-0.52.20160912git.el8.x86_64 1/1 Installed:net-tools-2.0-0.52.20160912git.el8.x86_64 Complete!
[root@mysql mysql]#
8所有依赖包安装 完成毕,再次执行
[root@mysql mysql]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm mysql-community-libs-8.0.33-1.el7.x86_64.rpm mysql-community-client-8.0.33-1.el7.x86_64.rpm mysql-community-server-8.0.33-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm mysql-community-devel-8.0.33-1.el7.x86_64.rpm mysql-community-test-8.0.33-1.el7.x86_64.rpm mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...1:mysql-community-client-plugins-8.################################# [ 11%]2:mysql-community-common-8.0.33-1.e################################# [ 22%]3:mysql-community-libs-8.0.33-1.el7################################# [ 33%]
/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic link4:mysql-community-client-8.0.33-1.e################################# [ 44%]5:mysql-community-icu-data-files-8.################################# [ 56%]6:mysql-community-server-8.0.33-1.e################################# [ 67%]7:mysql-community-test-8.0.33-1.el7################################# [ 78%]8:mysql-community-libs-compat-8.0.3################################# [ 89%]
/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic link9:mysql-community-devel-8.0.33-1.el################################# [100%]
/sbin/ldconfig: /usr/lib64/llvm15/lib/libclang.so.15 is not a symbolic link[/usr/lib/tmpfiles.d/pesign.conf:1] Line references path below legacy directory /var/run/, updating /var/run/pesign → /run/pesign; please update the tmpfiles.d/ drop-in file accordingly.
[root@mysql mysql]# rpm -qa | grep mysql
mysql-community-libs-compat-8.0.33-1.el7.x86_64
mysql-community-common-8.0.33-1.el7.x86_64
mysql-community-server-8.0.33-1.el7.x86_64
mysql-community-libs-8.0.33-1.el7.x86_64
mysql-community-icu-data-files-8.0.33-1.el7.x86_64
mysql-community-devel-8.0.33-1.el7.x86_64
mysql-community-client-8.0.33-1.el7.x86_64
mysql-community-client-plugins-8.0.33-1.el7.x86_64
mysql-community-test-8.0.33-1.el7.x86_64
[root@mysql mysql]#
三、初始化数据库,启动设置
初始化
[root@mysql mysql]# mysqld --initialize
2大小写敏感设置
[root@mysql mysql]# vi /etc/my.cnf
[root@mysql mysql]# tail -n 2 /etc/my.cnf
lower_case_table_names=0
3查看mysql服务
[root@mysql mysql]# ps -ef | grep mysql
root 36346 1591 0 11:16 pts/0 00:00:00 grep --color=auto mysql
[root@mysql mysql]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: inactive (dead)Docs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.html
4文件所有者和文件关联授权
[root@mysql mysql]# chown mysql:mysql /var/lib/mysql -R
5启动服务
[root@mysql mysql]# systemctl start mysqld
[root@mysql mysql]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Fri 2023-07-07 11:18:01 CST; 3s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 36352 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 36380 (mysqld)Status: "Server is operational"Tasks: 38 (limit: 23500)Memory: 409.1MCGroup: /system.slice/mysqld.service└─36380 /usr/sbin/mysqldJul 07 11:17:54 mysql systemd[1]: Starting MySQL Server...
Jul 07 11:18:01 mysql systemd[1]: Started MySQL Server.
[root@mysql mysql]# systemctl enable mysqld //设置开机启动
查看临时密码
[root@mysql mysql]# cat /var/log/mysqld.log | grep password
2023-07-07T03:14:50.510561Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: upcJufqZM1(<
[root@mysql mysql]# ~
临时密码登录
[root@mysql mysql]# grep 'temporary password' /var/log/mysqld.log
2023-07-07T03:14:50.510561Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: upcJufqZM1(<
[root@mysql mysql]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@mysql mysql]# mysql -uroot -p
Enter password: upcJufqZM1(< // 输入上面的临时密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.33Copyright (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.
修改本地root密码
mysql> alter user root@'localhost' identified with mysql_native_password by 'master';
Query OK, 0 rows affected (0.01 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)mysql> select Host,User from mysql.user;
+-----------+------------------+
| Host | User |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+------------------+
4 rows in set (0.00 sec)
//创建远程root用户
mysql> create user root@'%' identified with mysql_native_password by 'master';
Query OK, 0 rows affected (0.00 sec)mysql> grant all on *.* to root@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql>
数据表查询操作
mysql> show variables like 'character%';
+--------------------------+--------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb3 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8mb3 |
| character_sets_dir | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+
8 rows in set (0.00 sec)mysql> show tables;
+---------------------------------------+
| Tables_in_information_schema |
+---------------------------------------+
| ADMINISTRABLE_ROLE_AUTHORIZATIONS |
| APPLICABLE_ROLES |
| CHARACTER_SETS |
| CHECK_CONSTRAINTS |
| COLLATIONS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMNS_EXTENSIONS |
| COLUMN_PRIVILEGES |
| COLUMN_STATISTICS |
| ENABLED_ROLES |
| ENGINES |
| EVENTS |
| FILES |
| INNODB_BUFFER_PAGE |
| INNODB_BUFFER_PAGE_LRU |
| INNODB_BUFFER_POOL_STATS |
| INNODB_CACHED_INDEXES |
| INNODB_CMP |
| INNODB_CMPMEM |
| INNODB_CMPMEM_RESET |
| INNODB_CMP_PER_INDEX |
| INNODB_CMP_PER_INDEX_RESET |
| INNODB_CMP_RESET |
| INNODB_COLUMNS |
| INNODB_DATAFILES |
| INNODB_FIELDS |
| INNODB_FOREIGN |
| INNODB_FOREIGN_COLS |
| INNODB_FT_BEING_DELETED |
| INNODB_FT_CONFIG |
| INNODB_FT_DEFAULT_STOPWORD |
| INNODB_FT_DELETED |
| INNODB_FT_INDEX_CACHE |
| INNODB_FT_INDEX_TABLE |
| INNODB_INDEXES |
| INNODB_METRICS |
| INNODB_SESSION_TEMP_TABLESPACES |
| INNODB_TABLES |
| INNODB_TABLESPACES |
| INNODB_TABLESPACES_BRIEF |
| INNODB_TABLESTATS |
| INNODB_TEMP_TABLE_INFO |
| INNODB_TRX |
| INNODB_VIRTUAL |
| KEYWORDS |
| KEY_COLUMN_USAGE |
| OPTIMIZER_TRACE |
| PARAMETERS |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| PROFILING |
| REFERENTIAL_CONSTRAINTS |
| RESOURCE_GROUPS |
| ROLE_COLUMN_GRANTS |
| ROLE_ROUTINE_GRANTS |
| ROLE_TABLE_GRANTS |
| ROUTINES |
| SCHEMATA |
| SCHEMATA_EXTENSIONS |
| SCHEMA_PRIVILEGES |
| STATISTICS |
| ST_GEOMETRY_COLUMNS |
| ST_SPATIAL_REFERENCE_SYSTEMS |
| ST_UNITS_OF_MEASURE |
| TABLES |
| TABLESPACES |
| TABLESPACES_EXTENSIONS |
| TABLES_EXTENSIONS |
| TABLE_CONSTRAINTS |
| TABLE_CONSTRAINTS_EXTENSIONS |
| TABLE_PRIVILEGES |
| TRIGGERS |
| USER_ATTRIBUTES |
| USER_PRIVILEGES |
| VIEWS |
| VIEW_ROUTINE_USAGE |
| VIEW_TABLE_USAGE |
+---------------------------------------+
79 rows in set (0.00 sec)mysql> select distinct concat('user:''',user,'''@''',host,''';') as query from mysql.user;
+--------------------------------------+
| query |
+--------------------------------------+
| user:'root'@'%'; |
| user:'mysql.infoschema'@'localhost'; |
| user:'mysql.session'@'localhost'; |
| user:'mysql.sys'@'localhost'; |
| user:'root'@'localhost'; |
+--------------------------------------+
5 rows in set (0.01 sec)