在互联网企业的日常工作/运维中,我们会经常用到mysql数据库,而linux下mysql的安装方式有三种:
1.mysql rpm安装
2.mysql二进制安装
3.mysql源码安装
今天就为大家讲讲linux下mysql8.0.33版本rpm方式的安装。
1.前提
1.1.系统版本
CentOS7.9.2009
命令:
cat /etc/redhat-release
[root@cent79-2 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@cent79-2 ~]#
1.2.系统基础配置
参考:
Linux常规基础配置_小黑要上天的博客-CSDN博客
1.3.预安装数据库版本
mysql8.0.33
1.4.环境初始化
# 清除系统原有的MySQL环境
rm -rf /var/run/yum.pid && yum remove mysql* -y && yum remove mariadb* -y
find / -name mysql -exec rm -rf {} \;
# 删除原有的MySQL包
for i in `rpm -qa |grep mysql`
do
rpm -e --nodeps $i
done
2.mysql8.0.33介质下载
2.1.官网地址
官网地址:
https://dev.mysql.com/downloads/mysql/
2.2.安装软件包
命令:
yum install wget tar lrzsz
[root@cent79-2 ~]# yum install wget tar lrzsz
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
CentOS7 | 3.6 kB 00:00:00
Package 2:tar-1.26-35.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package lrzsz.x86_64 0:0.12.20-36.el7 will be installed
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
lrzsz x86_64 0.12.20-36.el7 CentOS7 78 k
wget x86_64 1.14-18.el7_6.1 CentOS7 547 k
Transaction Summary
==============================================================================================
Install 2 Packages
Total download size: 625 k
Installed size: 2.1 M
Is this ok [y/d/N]: y
Downloading packages:
----------------------------------------------------------------------------------------------
Total 380 kB/s | 625 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : wget-1.14-18.el7_6.1.x86_64 1/2
Installing : lrzsz-0.12.20-36.el7.x86_64 2/2
Verifying : lrzsz-0.12.20-36.el7.x86_64 1/2
Verifying : wget-1.14-18.el7_6.1.x86_64 2/2
Installed:
lrzsz.x86_64 0:0.12.20-36.el7 wget.x86_64 0:1.14-18.el7_6.1
Complete!
[root@cent79-2 ~]#
命令:
yum install ncurses-devel libaio-devel gcc gcc-c++ numactl libaio glibc cmake autoconf libstdc++.x86_64 libstdc++.i686 bzip2 bison net-tools -y
[root@cent79-2 ~]# yum install ncurses-devel libaio-devel gcc gcc-c++ numactl libaio glibc cmake autoconf libstdc++.x86_64 libstdc++.i686 bzip2 bison net-tools -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package libaio-0.3.109-13.el7.x86_64 already installed and latest version
Package glibc-2.17-317.el7.x86_64 already installed and latest version
Package libstdc++-4.8.5-44.el7.x86_64 already installed and latest version
No package libstdc++.i686 available.
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch 0:2.69-11.el7 will be installed
--> Processing Dependency: perl >= 5.006 for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: m4 >= 1.4.14 for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(warnings) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(vars) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(strict) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(constant) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(POSIX) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(IO::File) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Getopt::Long) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(File::stat) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(File::Spec) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(File::Path) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(File::Find) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(File::Copy) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(File::Compare) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(File::Basename) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Exporter) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Errno) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(DynaLoader) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Data::Dumper) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Cwd) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Class::Struct) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Carp) for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: /usr/bin/perl for package: autoconf-2.69-11.el7.noarch
---> Package bison.x86_64 0:3.0.4-2.el7 will be installed
---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
---> Package cmake.x86_64 0:2.8.12.2-2.el7 will be installed
--> Processing Dependency: libarchive.so.13()(64bit) for package: cmake-2.8.12.2-2.el7.x86_64
---> Package gcc.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: cpp = 4.8.5-44.el7 for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-44.el7.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-44.el7.x86_64
---> Package gcc-c++.x86_64 0:4.8.5-44.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-44.el7 for package: gcc-c++-4.8.5-44.el7.x86_64
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
---> Package ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed
---> Package numactl.x86_64 0:2.0.12-5.el7 will be installed
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-44.el7 will be installed
---> Package glibc-devel.x86_64 0:2.17-317.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-317.el7 for package: glibc-devel-2.17-317.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-317.el7.x86_64
---> Package libarchive.x86_64 0:3.1.2-14.el7_7 will be installed
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-44.el7 will be installed
---> Package m4.x86_64 0:1.4.16-10.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
---> Package perl.x86_64 4:5.16.3-297.el7 will be installed
--> Processing Dependency: perl-libs = 4:5.16.3-297.el7 for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-297.el7.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-297.el7.x86_64
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.17-317.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-317.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-317.el7.x86_64
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-5.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-libs.x86_64 4:5.16.3-297.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-297.el7 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
--> Running transaction check
---> Package kernel-headers.x86_64 0:3.10.0-1160.el7 will be installed
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-297.el7 will be installed
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
autoconf noarch 2.69-11.el7 CentOS7 701 k
bison x86_64 3.0.4-2.el7 CentOS7 674 k
bzip2 x86_64 1.0.6-13.el7 CentOS7 52 k
cmake x86_64 2.8.12.2-2.el7 CentOS7 7.1 M
gcc x86_64 4.8.5-44.el7 CentOS7 16 M
gcc-c++ x86_64 4.8.5-44.el7 CentOS7 7.2 M
libaio-devel x86_64 0.3.109-13.el7 CentOS7 13 k
ncurses-devel x86_64 5.9-14.20130511.el7_4 CentOS7 712 k
numactl x86_64 2.0.12-5.el7 CentOS7 66 k
Installing for dependencies:
cpp x86_64 4.8.5-44.el7 CentOS7 5.9 M
glibc-devel x86_64 2.17-317.el7 CentOS7 1.1 M
glibc-headers x86_64 2.17-317.el7 CentOS7 690 k
kernel-headers x86_64 3.10.0-1160.el7 CentOS7 9.0 M
libarchive x86_64 3.1.2-14.el7_7 CentOS7 319 k
libmpc x86_64 1.0.1-3.el7 CentOS7 51 k
libstdc++-devel x86_64 4.8.5-44.el7 CentOS7 1.5 M
m4 x86_64 1.4.16-10.el7 CentOS7 256 k
mpfr x86_64 3.1.1-4.el7 CentOS7 203 k
perl x86_64 4:5.16.3-297.el7 CentOS7 8.0 M
perl-Carp noarch 1.26-244.el7 CentOS7 19 k
perl-Data-Dumper x86_64 2.145-3.el7 CentOS7 47 k
perl-Encode x86_64 2.51-7.el7 CentOS7 1.5 M
perl-Exporter noarch 5.68-3.el7 CentOS7 28 k
perl-File-Path noarch 2.09-2.el7 CentOS7 26 k
perl-File-Temp noarch 0.23.01-3.el7 CentOS7 56 k
perl-Filter x86_64 1.49-3.el7 CentOS7 76 k
perl-Getopt-Long noarch 2.40-3.el7 CentOS7 56 k
perl-HTTP-Tiny noarch 0.033-3.el7 CentOS7 38 k
perl-PathTools x86_64 3.40-5.el7 CentOS7 82 k
perl-Pod-Escapes noarch 1:1.04-297.el7 CentOS7 52 k
perl-Pod-Perldoc noarch 3.20-4.el7 CentOS7 87 k
perl-Pod-Simple noarch 1:3.28-4.el7 CentOS7 216 k
perl-Pod-Usage noarch 1.63-3.el7 CentOS7 27 k
perl-Scalar-List-Utils x86_64 1.27-248.el7 CentOS7 36 k
perl-Socket x86_64 2.010-5.el7 CentOS7 49 k
perl-Storable x86_64 2.45-3.el7 CentOS7 77 k
perl-Text-ParseWords noarch 3.29-4.el7 CentOS7 14 k
perl-Time-HiRes x86_64 4:1.9725-3.el7 CentOS7 45 k
perl-Time-Local noarch 1.2300-2.el7 CentOS7 24 k
perl-constant noarch 1.27-2.el7 CentOS7 19 k
perl-libs x86_64 4:5.16.3-297.el7 CentOS7 689 k
perl-macros x86_64 4:5.16.3-297.el7 CentOS7 44 k
perl-parent noarch 1:0.225-244.el7 CentOS7 12 k
perl-podlators noarch 2.5.1-3.el7 CentOS7 112 k
perl-threads x86_64 1.87-4.el7 CentOS7 49 k
perl-threads-shared x86_64 1.43-6.el7 CentOS7 39 k
Transaction Summary
==============================================================================================
Install 9 Packages (+37 Dependent packages)
Total download size: 63 M
Installed size: 155 M
Downloading packages:
----------------------------------------------------------------------------------------------
Total 21 MB/s | 63 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mpfr-3.1.1-4.el7.x86_64 1/46
Installing : libmpc-1.0.1-3.el7.x86_64 2/46
Installing : m4-1.4.16-10.el7.x86_64 3/46
Installing : cpp-4.8.5-44.el7.x86_64 4/46
Installing : 1:perl-parent-0.225-244.el7.noarch 5/46
Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 6/46
Installing : perl-podlators-2.5.1-3.el7.noarch 7/46
Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 8/46
Installing : 1:perl-Pod-Escapes-1.04-297.el7.noarch 9/46
Installing : perl-Encode-2.51-7.el7.x86_64 10/46
Installing : perl-Text-ParseWords-3.29-4.el7.noarch 11/46
Installing : perl-Pod-Usage-1.63-3.el7.noarch 12/46
Installing : 4:perl-libs-5.16.3-297.el7.x86_64 13/46
Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 14/46
Installing : perl-Exporter-5.68-3.el7.noarch 15/46
Installing : perl-constant-1.27-2.el7.noarch 16/46
Installing : perl-threads-1.87-4.el7.x86_64 17/46
Installing : perl-Socket-2.010-5.el7.x86_64 18/46
Installing : perl-Time-Local-1.2300-2.el7.noarch 19/46
Installing : perl-Carp-1.26-244.el7.noarch 20/46
Installing : perl-Storable-2.45-3.el7.x86_64 21/46
Installing : perl-threads-shared-1.43-6.el7.x86_64 22/46
Installing : perl-PathTools-3.40-5.el7.x86_64 23/46
Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64 24/46
Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch 25/46
Installing : perl-File-Temp-0.23.01-3.el7.noarch 26/46
Installing : perl-File-Path-2.09-2.el7.noarch 27/46
Installing : perl-Filter-1.49-3.el7.x86_64 28/46
Installing : 4:perl-macros-5.16.3-297.el7.x86_64 29/46
Installing : perl-Getopt-Long-2.40-3.el7.noarch 30/46
Installing : 4:perl-5.16.3-297.el7.x86_64 31/46
Installing : perl-Data-Dumper-2.145-3.el7.x86_64 32/46
Installing : libarchive-3.1.2-14.el7_7.x86_64 33/46
Installing : libstdc++-devel-4.8.5-44.el7.x86_64 34/46
Installing : kernel-headers-3.10.0-1160.el7.x86_64 35/46
Installing : glibc-headers-2.17-317.el7.x86_64 36/46
Installing : glibc-devel-2.17-317.el7.x86_64 37/46
Installing : gcc-4.8.5-44.el7.x86_64 38/46
Installing : gcc-c++-4.8.5-44.el7.x86_64 39/46
Installing : cmake-2.8.12.2-2.el7.x86_64 40/46
Installing : autoconf-2.69-11.el7.noarch 41/46
Installing : bison-3.0.4-2.el7.x86_64 42/46
Installing : numactl-2.0.12-5.el7.x86_64 43/46
Installing : libaio-devel-0.3.109-13.el7.x86_64 44/46
Installing : ncurses-devel-5.9-14.20130511.el7_4.x86_64 45/46
Installing : bzip2-1.0.6-13.el7.x86_64 46/46
Verifying : perl-HTTP-Tiny-0.033-3.el7.noarch 1/46
Verifying : gcc-c++-4.8.5-44.el7.x86_64 2/46
Verifying : kernel-headers-3.10.0-1160.el7.x86_64 3/46
Verifying : perl-threads-shared-1.43-6.el7.x86_64 4/46
Verifying : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 5/46
Verifying : 4:perl-libs-5.16.3-297.el7.x86_64 6/46
Verifying : mpfr-3.1.1-4.el7.x86_64 7/46
Verifying : perl-Exporter-5.68-3.el7.noarch 8/46
Verifying : perl-constant-1.27-2.el7.noarch 9/46
Verifying : perl-PathTools-3.40-5.el7.x86_64 10/46
Verifying : perl-threads-1.87-4.el7.x86_64 11/46
Verifying : m4-1.4.16-10.el7.x86_64 12/46
Verifying : perl-Socket-2.010-5.el7.x86_64 13/46
Verifying : 1:perl-parent-0.225-244.el7.noarch 14/46
Verifying : bzip2-1.0.6-13.el7.x86_64 15/46
Verifying : 1:perl-Pod-Escapes-1.04-297.el7.noarch 16/46
Verifying : ncurses-devel-5.9-14.20130511.el7_4.x86_64 17/46
Verifying : cpp-4.8.5-44.el7.x86_64 18/46
Verifying : 1:perl-Pod-Simple-3.28-4.el7.noarch 19/46
Verifying : perl-Time-Local-1.2300-2.el7.noarch 20/46
Verifying : libstdc++-devel-4.8.5-44.el7.x86_64 21/46
Verifying : perl-Carp-1.26-244.el7.noarch 22/46
Verifying : libarchive-3.1.2-14.el7_7.x86_64 23/46
Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 24/46
Verifying : glibc-headers-2.17-317.el7.x86_64 25/46
Verifying : perl-Storable-2.45-3.el7.x86_64 26/46
Verifying : gcc-4.8.5-44.el7.x86_64 27/46
Verifying : perl-Scalar-List-Utils-1.27-248.el7.x86_64 28/46
Verifying : libaio-devel-0.3.109-13.el7.x86_64 29/46
Verifying : libmpc-1.0.1-3.el7.x86_64 30/46
Verifying : perl-File-Temp-0.23.01-3.el7.noarch 31/46
Verifying : numactl-2.0.12-5.el7.x86_64 32/46
Verifying : perl-Pod-Usage-1.63-3.el7.noarch 33/46
Verifying : perl-Encode-2.51-7.el7.x86_64 34/46
Verifying : glibc-devel-2.17-317.el7.x86_64 35/46
Verifying : bison-3.0.4-2.el7.x86_64 36/46
Verifying : perl-Pod-Perldoc-3.20-4.el7.noarch 37/46
Verifying : perl-podlators-2.5.1-3.el7.noarch 38/46
Verifying : autoconf-2.69-11.el7.noarch 39/46
Verifying : perl-File-Path-2.09-2.el7.noarch 40/46
Verifying : cmake-2.8.12.2-2.el7.x86_64 41/46
Verifying : perl-Filter-1.49-3.el7.x86_64 42/46
Verifying : perl-Getopt-Long-2.40-3.el7.noarch 43/46
Verifying : perl-Text-ParseWords-3.29-4.el7.noarch 44/46
Verifying : 4:perl-5.16.3-297.el7.x86_64 45/46
Verifying : 4:perl-macros-5.16.3-297.el7.x86_64 46/46
Installed:
autoconf.noarch 0:2.69-11.el7 bison.x86_64 0:3.0.4-2.el7
bzip2.x86_64 0:1.0.6-13.el7 cmake.x86_64 0:2.8.12.2-2.el7
gcc.x86_64 0:4.8.5-44.el7 gcc-c++.x86_64 0:4.8.5-44.el7
libaio-devel.x86_64 0:0.3.109-13.el7 ncurses-devel.x86_64 0:5.9-14.20130511.el7_4
numactl.x86_64 0:2.0.12-5.el7
Dependency Installed:
cpp.x86_64 0:4.8.5-44.el7 glibc-devel.x86_64 0:2.17-317.el7
glibc-headers.x86_64 0:2.17-317.el7 kernel-headers.x86_64 0:3.10.0-1160.el7
libarchive.x86_64 0:3.1.2-14.el7_7 libmpc.x86_64 0:1.0.1-3.el7
libstdc++-devel.x86_64 0:4.8.5-44.el7 m4.x86_64 0:1.4.16-10.el7
mpfr.x86_64 0:3.1.1-4.el7 perl.x86_64 4:5.16.3-297.el7
perl-Carp.noarch 0:1.26-244.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7
perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7
perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7
perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7
perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7
perl-Pod-Escapes.noarch 1:1.04-297.el7 perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7
perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-5.el7
perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7
perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7
perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-297.el7
perl-macros.x86_64 4:5.16.3-297.el7 perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7
perl-threads-shared.x86_64 0:1.43-6.el7
Complete!
[root@cent79-2 ~]#
2.3.mysql8.0.33介质下载
命令:
cd /root
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
[root@cent79-2 ~]# cd /root
[root@cent79-2 ~]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
--2023-07-11 15:12:14-- 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)... 23.41.161.20
Connecting to cdn.mysql.com (cdn.mysql.com)|23.41.161.20|: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’
0% [ ] 7,162,447 2.61MB/s
[root@cent79-2 ~]#
[root@cent79-2 ~]# ls
anaconda-ks.cfg mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
[root@cent79-2 ~]#
2.4.mysql8.0.33安装
2.4.1.解压mysql8.0.33介质
命令:
tar -xvf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
[root@cent79-2 ~]# 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@cent79-2 ~]# ls
anaconda-ks.cfg
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@cent79-2 ~]#
2.4.2.mysql8.0.33安装
命令(安装顺序一定不能变):
rpm -ivh --nodeps --force mysql-community-common-8.0.33-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-libs-8.0.33-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-client-8.0.33-1.el7.x86_64.rpm
rpm -ivh --nodeps --force mysql-community-server-8.0.33-1.el7.x86_64.rpm
[root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-common-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
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-8.0.33-1.e################################# [100%]
[root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-libs-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-libs-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-8.0.33-1.el7################################# [100%]
[root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-client-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-client-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-8.0.33-1.e################################# [100%]
[root@cent79-2 ~]# rpm -ivh --nodeps --force mysql-community-server-8.0.33-1.el7.x86_64.rpm
warning: mysql-community-server-8.0.33-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-8.0.33-1.e################################# [100%]
[root@cent79-2 ~]#
[root@cent79-2 ~]#
2.4.3.mysql安装后确认
mysql8.0.33默认安装在/var/lib/mysql目录,且会默认创建mysql用户
rpm -qa |grep mysql
cd /var/lib
ls -ld mysql*
cat /etc/passwd |grep mysql
[root@cent79-2 mysql]# rpm -qa |grep mysql
mysql-community-libs-8.0.33-1.el7.x86_64
mysql-community-server-8.0.33-1.el7.x86_64
mysql-community-common-8.0.33-1.el7.x86_64
mysql-community-client-8.0.33-1.el7.x86_64
[root@cent79-2 mysql]#
[root@cent79-2 lib]# cd /var/lib/
[root@cent79-2 lib]# ls -ld mysql*
drwxr-x--x 2 mysql mysql 6 Mar 17 02:51 mysql
drwxr-x--- 2 mysql mysql 6 Mar 17 02:51 mysql-files
drwxr-x--- 2 mysql mysql 6 Mar 17 02:51 mysql-keyring
[root@cent79-2 lib]# cat /etc/passwd |grep mysql
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false
[root@cent79-2 lib]#
2.4.4.启动mysql
命令:
systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld
cd /var/lib/mysql
ls -l
[root@cent79-2 lib]# systemctl start mysqld
[root@cent79-2 lib]# systemctl enable mysqld
[root@cent79-2 lib]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2023-07-11 15:29:51 CST; 10s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 1966 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─1966 /usr/sbin/mysqld
Jul 11 15:29:39 cent79-2 systemd[1]: Starting MySQL Server...
Jul 11 15:29:51 cent79-2 systemd[1]: Started MySQL Server.
[root@cent79-2 lib]# cd mysql
[root@cent79-2 mysql]# ls
auto.cnf client-cert.pem ibdata1 mysql.ibd public_key.pem undo_002
binlog.000001 client-key.pem ibtmp1 mysql.sock server-cert.pem
binlog.index #ib_16384_0.dblwr #innodb_redo mysql.sock.lock server-key.pem
ca-key.pem #ib_16384_1.dblwr #innodb_temp performance_schema sys
ca.pem ib_buffer_pool mysql private_key.pem undo_001
[root@cent79-2 mysql]# ls -l
total 90568
-rw-r----- 1 mysql mysql 56 Jul 11 15:29 auto.cnf
-rw-r----- 1 mysql mysql 157 Jul 11 15:29 binlog.000001
-rw-r----- 1 mysql mysql 16 Jul 11 15:29 binlog.index
-rw------- 1 mysql mysql 1676 Jul 11 15:29 ca-key.pem
-rw-r--r-- 1 mysql mysql 1112 Jul 11 15:29 ca.pem
-rw-r--r-- 1 mysql mysql 1112 Jul 11 15:29 client-cert.pem
-rw------- 1 mysql mysql 1676 Jul 11 15:29 client-key.pem
-rw-r----- 1 mysql mysql 196608 Jul 11 15:29 #ib_16384_0.dblwr
-rw-r----- 1 mysql mysql 8585216 Jul 11 15:29 #ib_16384_1.dblwr
-rw-r----- 1 mysql mysql 5985 Jul 11 15:29 ib_buffer_pool
-rw-r----- 1 mysql mysql 12582912 Jul 11 15:29 ibdata1
-rw-r----- 1 mysql mysql 12582912 Jul 11 15:29 ibtmp1
drwxr-x--- 2 mysql mysql 4096 Jul 11 15:29 #innodb_redo
drwxr-x--- 2 mysql mysql 187 Jul 11 15:29 #innodb_temp
drwxr-x--- 2 mysql mysql 143 Jul 11 15:29 mysql
-rw-r----- 1 mysql mysql 25165824 Jul 11 15:29 mysql.ibd
srwxrwxrwx 1 mysql mysql 0 Jul 11 15:29 mysql.sock
-rw------- 1 mysql mysql 5 Jul 11 15:29 mysql.sock.lock
drwxr-x--- 2 mysql mysql 8192 Jul 11 15:29 performance_schema
-rw------- 1 mysql mysql 1676 Jul 11 15:29 private_key.pem
-rw-r--r-- 1 mysql mysql 452 Jul 11 15:29 public_key.pem
-rw-r--r-- 1 mysql mysql 1112 Jul 11 15:29 server-cert.pem
-rw------- 1 mysql mysql 1676 Jul 11 15:29 server-key.pem
drwxr-x--- 2 mysql mysql 28 Jul 11 15:29 sys
-rw-r----- 1 mysql mysql 16777216 Jul 11 15:29 undo_001
-rw-r----- 1 mysql mysql 16777216 Jul 11 15:29 undo_002
[root@cent79-2 mysql]#
2.4.5.修改mysql密码
命令:
grep "password" /var/log/mysqld.log --查找初始密码
/usr/bin/mysqladmin -uroot -p'${old_passwd}' password '${new_passwd}' --修改mysql密码
[root@cent79-2 log]# grep "password" /var/log/mysqld.log
2023-07-11T07:29:44.693012Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: J%LdHu9HRse4
[root@cent79-2 log]#
[root@cent79-2 log]# /usr/bin/mysqladmin -uroot -p'J%LdHu9HRse4' password 'Root2#admin'
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
[root@cent79-2 log]#
2.4.6.mysql登录验证
命令:
mysql -uroot -pRoot2#admin
[root@cent79-2 log]# mysql -uroot -pRoot2#admin
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 10
Server version: 8.0.33 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>
2.4.7.mysql用户root密码更改
命令:
show variables like '%valid%';
mysql> show variables like '%valid%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| innodb_validate_tablespace_paths | ON |
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 8 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | MEDIUM |
| validate_password.special_char_count | 1 |
+--------------------------------------+--------+
8 rows in set (0.00 sec)
mysql>
命令:
set global validate_password.check_user_name=OFF;
set global validate_password.policy=0;
set global validate_password.length=4;
flush privileges;
show variables like '%valid%';
mysql> set global validate_password.check_user_name=OFF;
Query OK, 0 rows affected (0.01 sec)
mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password.length=4;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like '%valid%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| innodb_validate_tablespace_paths | ON |
| validate_password.check_user_name | OFF |
| validate_password.dictionary_file | |
| validate_password.length | 4 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | LOW |
| validate_password.special_char_count | 1 |
+--------------------------------------+-------+
8 rows in set (0.00 sec)
命令:
update user set authentication_string='' where user='root';
alter user 'root'@'localhost' identified with mysql_native_password by 'root';
flush privileges;
mysql> update user set authentication_string='' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> alter user 'root'@'localhost' identified with mysql_native_password by 'root';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
退出验证:
命令:
exit
mysql -uroot -proot
mysql> exit
Bye
[root@cent79-2 log]# mysql -uroot -pRoot2#admin
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@cent79-2 log]# mysql -uroot -proot
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 12
Server version: 8.0.33 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>
2.4.8.创建可登录的远程登录用户
命令:
create user 'root'@'%' identified with mysql_native_password by '${password}; --创建可登录的远程登录用户
grant all privileges on *.* to root@'%'; --授权
flush privileges; --刷新
select host,user,plugin,authentication_string from mysql.user;
mysql> create user 'root'@'%' identified with mysql_native_password by 'root';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to root@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,plugin,authentication_string from mysql.user;
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| host | user | plugin | authentication_string |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
| % | root | mysql_native_password | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| localhost | mysql.infoschema | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.session | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | mysql.sys | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| localhost | root | mysql_native_password | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+-----------+------------------+-----------------------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)
mysql>
Navicat远程连接验证:
至此,linux下mysql8.0.33安装已经完成。