龙空技术网

MySQL8安装 七: 使用官方源安装

贺浦力特 191

前言:

现在大家对“debian8mysql”可能比较关切,各位老铁们都需要知道一些“debian8mysql”的相关内容。那么小编同时在网摘上汇集了一些对于“debian8mysql””的相关知识,希望同学们能喜欢,兄弟们快快来了解一下吧!

MySQL8安装 一 : 源码安装

MySQL8安装 二 : 二进制安装

MySQL8安装 三: 二进制安装配置多实例

MySQL8安装 四: docker安装

MySQL8安装 五: 安装包安装

MySQL8安装 六: 安装包安装配置多实例

MySQL8安装 七: 使用官方源安装

MySQL8安装 八: 使用phpMyadmin客户端

9de7bb31d0644e7393039222babfed10

以上的几种安装方式(二进制,源码,安装包)都需要下载源码,二进制文件,安装包等,适用于服务器不能连接互联网的场景。

docker镜像安装能联网则可以直接拉镜像,不能联网可以先下载镜像再导入。

现在简略记录下如何使用官方源安装, 这种方式服务器必须能够联网。

下载地址

CentOS7.9安装MySQL8源

点击 MySQL Yum Repository 进入到下载页面

可以下载rpm包,然后安装。

也可以直接yum安装这个源包。

我们右键复制可以得到地址为

如下就把源安装上去了。装完了在yum配置目录/etc/yum.repos.d/下多了3个文件。后面的MySQL就是从这里下载安装包。

[root@localhost ~]# yum -y install  plugins: fastestmirrormysql80-community-release-el7-7.noarch.rpm                                                                                  |  11 kB  00:00:00     Examining /var/tmp/yum-root-3wTq5S/mysql80-community-release-el7-7.noarch.rpm: mysql80-community-release-el7-7.noarchMarking /var/tmp/yum-root-3wTq5S/mysql80-community-release-el7-7.noarch.rpm to be installedResolving Dependencies--> Running transaction check---> Package mysql80-community-release.noarch 0:el7-7 will be installed--> Finished Dependency ResolutionDependencies Resolved=================================================================================================================================================== Package                                  Arch                  Version               Repository                                              Size===================================================================================================================================================Installing: mysql80-community-release                noarch                el7-7                 /mysql80-community-release-el7-7.noarch                 10 kTransaction Summary===================================================================================================================================================Install  1 PackageTotal size: 10 kInstalled size: 10 kDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Installing : mysql80-community-release-el7-7.noarch                                                                                          1/1   Verifying  : mysql80-community-release-el7-7.noarch                                                                                          1/1 Installed:  mysql80-community-release.noarch 0:el7-7                                                                                                         Complete!  [root@localhost ~]# ll /etc/yum.repos.d/mysql-community*-rw-r--r--. 1 root root 1147 Aug 27  2022 /etc/yum.repos.d/mysql-community-debuginfo.repo-rw-r--r--. 1 root root 2062 Aug 27  2022 /etc/yum.repos.d/mysql-community.repo-rw-r--r--. 1 root root 2132 Aug 27  2022 /etc/yum.repos.d/mysql-community-source.repo
CentOS7.9安装MySQL8数据库

耗时具体看网速, 有的可能要10分钟甚至更长。

和下载安装包差不多, 只是自动下载安装包了, 后面启动服务和修改密码和使用rpm包安装是一样的

[root@localhost ~]# yum -y remove mariadb-libsLoaded plugins: fastestmirrorResolving Dependencies--> Running transaction check---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be erased--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64--> Running transaction check---> Package postfix.x86_64 2:2.10.1-9.el7 will be erased--> Finished Dependency ResolutionDependencies Resolved=================================================================================================================================================== Package                             Arch                          Version                                  Repository                        Size===================================================================================================================================================Removing: mariadb-libs                        x86_64                        1:5.5.68-1.el7                           @anaconda                        4.4 MRemoving for dependencies: postfix                             x86_64                        2:2.10.1-9.el7                           @anaconda                         12 MTransaction Summary===================================================================================================================================================Remove  1 Package (+1 Dependent package)Installed size: 17 MDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Erasing    : 2:postfix-2.10.1-9.el7.x86_64                                                                                                   1/2   Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                              2/2   Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                              1/2   Verifying  : 2:postfix-2.10.1-9.el7.x86_64                                                                                                   2/2 Removed:  mariadb-libs.x86_64 1:5.5.68-1.el7                                                                                                               Dependency Removed:  postfix.x86_64 2:2.10.1-9.el7                                                                                                                    Complete![root@localhost ~]# yum -y install mysql-community-serverLoaded plugins: fastestmirrorDetermining fastest mirrorscentos_base                                                                                                                 | 3.6 kB  00:00:00     mysql-connectors-community                                                                                                  | 2.6 kB  00:00:00     mysql-tools-community                                                                                                       | 2.6 kB  00:00:00     mysql80-community                                                                                                           | 2.6 kB  00:00:00     (1/3): mysql-connectors-community/x86_64/primary_db                                                                         |  96 kB  00:00:01     (2/3): mysql-tools-community/x86_64/primary_db                                                                              |  91 kB  00:00:02     (3/3): mysql80-community/x86_64/primary_db                                                                                  | 231 kB  00:00:03     Resolving Dependencies--> Running transaction check---> Package mysql-community-server.x86_64 0:8.0.32-1.el7 will be installed--> Processing Dependency: mysql-community-common(x86-64) = 8.0.32-1.el7 for package: mysql-community-server-8.0.32-1.el7.x86_64--> Processing Dependency: mysql-community-icu-data-files = 8.0.32-1.el7 for package: mysql-community-server-8.0.32-1.el7.x86_64--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.32-1.el7.x86_64--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-8.0.32-1.el7.x86_64--> Processing Dependency: net-tools for package: mysql-community-server-8.0.32-1.el7.x86_64--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-8.0.32-1.el7.x86_64--> Processing Dependency: perl(strict) for package: mysql-community-server-8.0.32-1.el7.x86_64--> Running transaction check---> Package mysql-community-client.x86_64 0:8.0.32-1.el7 will be installed--> Processing Dependency: mysql-community-client-plugins = 8.0.32-1.el7 for package: mysql-community-client-8.0.32-1.el7.x86_64--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.32-1.el7.x86_64---> Package mysql-community-common.x86_64 0:8.0.32-1.el7 will be installed---> Package mysql-community-icu-data-files.x86_64 0:8.0.32-1.el7 will be installed---> Package net-tools.x86_64 0:2.0-0.25.20131004git.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(constant) 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: perl(File::Spec::Unix) for package: 4:perl-5.16.3-297.el7.x86_64--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-297.el7.x86_64--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-297.el7.x86_64--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-297.el7.x86_64--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-297.el7.x86_64--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-297.el7.x86_64--> Processing Dependency: perl(Carp) 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-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--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch--> Running transaction check---> Package mysql-community-client-plugins.x86_64 0:8.0.32-1.el7 will be installed---> Package mysql-community-libs.x86_64 0:8.0.32-1.el7 will be installed---> Package perl-Carp.noarch 0:1.26-244.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-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-PathTools.x86_64 0:3.40-5.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-Text-ParseWords.noarch 0:3.29-4.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-constant.noarch 0:1.27-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 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 ResolutionDependencies Resolved=================================================================================================================================================== Package                                      Arch                 Version                                   Repository                       Size===================================================================================================================================================Installing: mysql-community-server                       x86_64               8.0.32-1.el7                              mysql80-community                64 MInstalling for dependencies: mysql-community-client                       x86_64               8.0.32-1.el7                              mysql80-community                16 M mysql-community-client-plugins               x86_64               8.0.32-1.el7                              mysql80-community               2.5 M mysql-community-common                       x86_64               8.0.32-1.el7                              mysql80-community               654 k mysql-community-icu-data-files               x86_64               8.0.32-1.el7                              mysql80-community               2.1 M mysql-community-libs                         x86_64               8.0.32-1.el7                              mysql80-community               1.5 M net-tools                                    x86_64               2.0-0.25.20131004git.el7                  centos_base                     306 k perl                                         x86_64               4:5.16.3-297.el7                          centos_base                     8.0 M perl-Carp                                    noarch               1.26-244.el7                              centos_base                      19 k perl-Encode                                  x86_64               2.51-7.el7                                centos_base                     1.5 M perl-Exporter                                noarch               5.68-3.el7                                centos_base                      28 k perl-File-Path                               noarch               2.09-2.el7                                centos_base                      26 k perl-File-Temp                               noarch               0.23.01-3.el7                             centos_base                      56 k perl-Filter                                  x86_64               1.49-3.el7                                centos_base                      76 k perl-Getopt-Long                             noarch               2.40-3.el7                                centos_base                      56 k perl-HTTP-Tiny                               noarch               0.033-3.el7                               centos_base                      38 k perl-PathTools                               x86_64               3.40-5.el7                                centos_base                      82 k perl-Pod-Escapes                             noarch               1:1.04-297.el7                            centos_base                      52 k perl-Pod-Perldoc                             noarch               3.20-4.el7                                centos_base                      87 k perl-Pod-Simple                              noarch               1:3.28-4.el7                              centos_base                     216 k perl-Pod-Usage                               noarch               1.63-3.el7                                centos_base                      27 k perl-Scalar-List-Utils                       x86_64               1.27-248.el7                              centos_base                      36 k perl-Socket                                  x86_64               2.010-5.el7                               centos_base                      49 k perl-Storable                                x86_64               2.45-3.el7                                centos_base                      77 k perl-Text-ParseWords                         noarch               3.29-4.el7                                centos_base                      14 k perl-Time-HiRes                              x86_64               4:1.9725-3.el7                            centos_base                      45 k perl-Time-Local                              noarch               1.2300-2.el7                              centos_base                      24 k perl-constant                                noarch               1.27-2.el7                                centos_base                      19 k perl-libs                                    x86_64               4:5.16.3-297.el7                          centos_base                     689 k perl-macros                                  x86_64               4:5.16.3-297.el7                          centos_base                      44 k perl-parent                                  noarch               1:0.225-244.el7                           centos_base                      12 k perl-podlators                               noarch               2.5.1-3.el7                               centos_base                     112 k perl-threads                                 x86_64               1.87-4.el7                                centos_base                      49 k perl-threads-shared                          x86_64               1.43-6.el7                                centos_base                      39 kTransaction Summary===================================================================================================================================================Install  1 Package (+33 Dependent packages)Total download size: 99 MInstalled size: 447 MDownloading packages:warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-plugins-8.0.32-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEYPublic key for mysql-community-client-plugins-8.0.32-1.el7.x86_64.rpm is not installed(1/6): mysql-community-client-plugins-8.0.32-1.el7.x86_64.rpm                                                               | 2.5 MB  00:00:43     (2/6): mysql-community-common-8.0.32-1.el7.x86_64.rpm                                                                       | 654 kB  00:00:09     (3/6): mysql-community-client-8.0.32-1.el7.x86_64.rpm                                                                       |  16 MB  00:01:02     (4/6): mysql-community-libs-8.0.32-1.el7.x86_64.rpm                                                                         | 1.5 MB  00:00:10     (5/6): mysql-community-icu-data-files-8.0.32-1.el7.x86_64.rpm                                                               | 2.1 MB  00:00:30     (6/6): mysql-community-server-8.0.32-1.el7.x86_64.rpm                                                                       |  64 MB  00:09:46     ---------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                              153 kB/s |  99 MB  00:10:59     Retrieving key from  GPG key 0x3A79BD29: Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>" Fingerprint: 859b e8d7 c586 f538 430b 19c2 467b 942d 3a79 bd29 Package    : mysql80-community-release-el7-7.noarch (@/mysql80-community-release-el7-7.noarch) From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022Retrieving key from  GPG key 0x5072E1F5: Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>" Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 Package    : mysql80-community-release-el7-7.noarch (@/mysql80-community-release-el7-7.noarch) From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlRunning transaction checkRunning transaction testTransaction test succeededRunning transaction  Installing : mysql-community-client-plugins-8.0.32-1.el7.x86_64                                                                             1/34   Installing : mysql-community-common-8.0.32-1.el7.x86_64                                                                                     2/34   Installing : mysql-community-libs-8.0.32-1.el7.x86_64                                                                                       3/34   Installing : mysql-community-client-8.0.32-1.el7.x86_64                                                                                     4/34   Installing : 1:perl-parent-0.225-244.el7.noarch                                                                                             5/34   Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                              6/34   Installing : perl-podlators-2.5.1-3.el7.noarch                                                                                              7/34   Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                             8/34   Installing : 1:perl-Pod-Escapes-1.04-297.el7.noarch                                                                                         9/34   Installing : perl-Encode-2.51-7.el7.x86_64                                                                                                 10/34   Installing : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                        11/34   Installing : perl-Pod-Usage-1.63-3.el7.noarch                                                                                              12/34   Installing : 4:perl-libs-5.16.3-297.el7.x86_64                                                                                             13/34   Installing : perl-Storable-2.45-3.el7.x86_64                                                                                               14/34   Installing : perl-constant-1.27-2.el7.noarch                                                                                               15/34   Installing : perl-Socket-2.010-5.el7.x86_64                                                                                                16/34   Installing : perl-Time-Local-1.2300-2.el7.noarch                                                                                           17/34   Installing : perl-Carp-1.26-244.el7.noarch                                                                                                 18/34   Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                         19/34   Installing : perl-PathTools-3.40-5.el7.x86_64                                                                                              20/34   Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                    21/34   Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                           22/34   Installing : perl-Exporter-5.68-3.el7.noarch                                                                                               23/34   Installing : perl-threads-shared-1.43-6.el7.x86_64                                                                                         24/34   Installing : perl-threads-1.87-4.el7.x86_64                                                                                                25/34   Installing : perl-Filter-1.49-3.el7.x86_64                                                                                                 26/34   Installing : perl-File-Temp-0.23.01-3.el7.noarch                                                                                           27/34   Installing : perl-File-Path-2.09-2.el7.noarch                                                                                              28/34   Installing : 4:perl-macros-5.16.3-297.el7.x86_64                                                                                           29/34   Installing : perl-Getopt-Long-2.40-3.el7.noarch                                                                                            30/34   Installing : 4:perl-5.16.3-297.el7.x86_64                                                                                                  31/34   Installing : mysql-community-icu-data-files-8.0.32-1.el7.x86_64                                                                            32/34   Installing : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                     33/34   Installing : mysql-community-server-8.0.32-1.el7.x86_64                                                                                    34/34   Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                              1/34   Verifying  : perl-threads-shared-1.43-6.el7.x86_64                                                                                          2/34   Verifying  : perl-Storable-2.45-3.el7.x86_64                                                                                                3/34   Verifying  : 4:perl-libs-5.16.3-297.el7.x86_64                                                                                              4/34   Verifying  : mysql-community-client-8.0.32-1.el7.x86_64                                                                                     5/34   Verifying  : perl-constant-1.27-2.el7.noarch                                                                                                6/34   Verifying  : perl-PathTools-3.40-5.el7.x86_64                                                                                               7/34   Verifying  : perl-Socket-2.010-5.el7.x86_64                                                                                                 8/34   Verifying  : mysql-community-server-8.0.32-1.el7.x86_64                                                                                     9/34   Verifying  : 1:perl-parent-0.225-244.el7.noarch                                                                                            10/34   Verifying  : 1:perl-Pod-Escapes-1.04-297.el7.noarch                                                                                        11/34   Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                                                                                           12/34   Verifying  : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                     13/34   Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                           14/34   Verifying  : perl-Time-Local-1.2300-2.el7.noarch                                                                                           15/34   Verifying  : mysql-community-common-8.0.32-1.el7.x86_64                                                                                    16/34   Verifying  : perl-Carp-1.26-244.el7.noarch                                                                                                 17/34   Verifying  : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                         18/34   Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                    19/34   Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                                                                                              20/34   Verifying  : perl-Encode-2.51-7.el7.x86_64                                                                                                 21/34   Verifying  : perl-Exporter-5.68-3.el7.noarch                                                                                               22/34   Verifying  : mysql-community-libs-8.0.32-1.el7.x86_64                                                                                      23/34   Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                            24/34   Verifying  : perl-podlators-2.5.1-3.el7.noarch                                                                                             25/34   Verifying  : mysql-community-icu-data-files-8.0.32-1.el7.x86_64                                                                            26/34   Verifying  : perl-threads-1.87-4.el7.x86_64                                                                                                27/34   Verifying  : perl-Filter-1.49-3.el7.x86_64                                                                                                 28/34   Verifying  : perl-Getopt-Long-2.40-3.el7.noarch                                                                                            29/34   Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                        30/34   Verifying  : perl-File-Path-2.09-2.el7.noarch                                                                                              31/34   Verifying  : mysql-community-client-plugins-8.0.32-1.el7.x86_64                                                                            32/34   Verifying  : 4:perl-5.16.3-297.el7.x86_64                                                                                                  33/34   Verifying  : 4:perl-macros-5.16.3-297.el7.x86_64                                                                                           34/34 Installed:  mysql-community-server.x86_64 0:8.0.32-1.el7                                                                                                     Dependency Installed:  mysql-community-client.x86_64 0:8.0.32-1.el7                         mysql-community-client-plugins.x86_64 0:8.0.32-1.el7                          mysql-community-common.x86_64 0:8.0.32-1.el7                         mysql-community-icu-data-files.x86_64 0:8.0.32-1.el7                          mysql-community-libs.x86_64 0:8.0.32-1.el7                           net-tools.x86_64 0:2.0-0.25.20131004git.el7                                   perl.x86_64 4:5.16.3-297.el7                                         perl-Carp.noarch 0:1.26-244.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@localhost ~]# systemctl --now enable mysqld[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log #记录下临时产生的root密码2023-04-11T09:34:03.954875Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: x)k(Wo4kPKeP[root@localhost ~]# mysql -u root -p`grep 'temporary password' /var/log/mysqld.log|tail -1 |awk '{print $NF}'`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 8Server version: 8.0.32Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> set password='Root_1qaz';Query OK, 0 rows affected (0.01 sec)
Ubuntu22.04安装MySQL8源

点击 MySQL APT Repository 进入到下载页面

可以下载deb包,然后安装。

我们右键复制可以得到地址为

如下就把源安装上去了。装完了在apt配置目录/etc/apt/sources.list.d/下多了1个文件。后面的MySQL就是从这里下载安装包。

root@vm01:~# wget  09:31:38--   dev.mysql.com (dev.mysql.com)... 104.71.161.87, 2600:140b:2:99d::2e31, 2600:140b:2:99c::2e31Connecting to dev.mysql.com (dev.mysql.com)|104.71.161.87|:443... connected.HTTP request sent, awaiting response... 302 Moved TemporarilyLocation:  [following]--2023-04-11 09:31:39--   repo.mysql.com (repo.mysql.com)... 23.203.124.221Connecting to repo.mysql.com (repo.mysql.com)|23.203.124.221|:443... connected.HTTP request sent, awaiting response... 200 OKLength: 18048 (18K) [application/x-debian-package]Saving to: ‘mysql-apt-config_0.8.24-1_all.deb’mysql-apt-config_0.8.24-1_all.deb    100%[=====================================================================>]  17.62K  --.-KB/s    in 0.02s   2023-04-11 09:31:39 (719 KB/s) - ‘mysql-apt-config_0.8.24-1_all.deb’ saved [18048/18048]root@vm01:~# apt install ./mysql-apt-config_0.8.24-1_all.deb Reading package lists... DoneBuilding dependency tree... DoneReading state information... DoneNote, selecting 'mysql-apt-config' instead of './mysql-apt-config_0.8.24-1_all.deb'The following NEW packages will be installed:  mysql-apt-config0 upgraded, 1 newly installed, 0 to remove and 303 not upgraded.Need to get 0 B/18.0 kB of archives.After this operation, 35.8 kB of additional disk space will be used.Get:1 /root/mysql-apt-config_0.8.24-1_all.deb mysql-apt-config all 0.8.24-1 [18.0 kB]Preconfiguring packages ...Selecting previously unselected package mysql-apt-config.(Reading database ... 170919 files and directories currently installed.)Preparing to unpack .../mysql-apt-config_0.8.24-1_all.deb ...Unpacking mysql-apt-config (0.8.24-1) ...Setting up mysql-apt-config (0.8.24-1) ...Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).OKN: Download is performed unsandboxed as root as file '/root/mysql-apt-config_0.8.24-1_all.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

安装过程中提示选择安装的内容,选ok就行

Ubuntu22.04安装MySQL8数据库

需要先apt update 刷新源, 注意我们要安装的是mysql-community-server而不是 mysql-server-8.0, 所以要运行 apt -y install mysql-community-server

root@vm01:~# apt updateHit:1  jammy InReleaseGet:2  jammy-updates InRelease [119 kB]                                Get:3  jammy-backports InRelease [108 kB]                                                               Get:4  jammy InRelease [15.2 kB]               Get:5  jammy-security InRelease [110 kB]                  Get:6  jammy-updates/main i386 Packages [467 kB]                     Get:7  jammy-updates/main amd64 Packages [990 kB]                   Get:8  jammy/mysql-8.0 Sources [966 B]        Get:9  jammy-security/main amd64 Packages [728 kB]Get:10  jammy/mysql-apt-config amd64 Packages [565 B]  Get:11  jammy/mysql-apt-config i386 Packages [565 B]   Get:12  jammy/mysql-8.0 amd64 Packages [8,555 B]                               Get:13  jammy/mysql-tools i386 Packages [455 B]                    Get:14  jammy/mysql-tools amd64 Packages [7,905 B]                 Get:15  jammy-security/main i386 Packages [279 kB]                                        Get:16  jammy-security/main Translation-en [147 kB]                Get:17  jammy-security/main amd64 DEP-11 Metadata [41.4 kB]                                      Get:18  jammy-security/main DEP-11 48x48 Icons [13.8 kB]                                              Get:19  jammy-security/main DEP-11 64x64 Icons [22.7 kB]                                                Get:20  jammy-security/main amd64 c-n-f Metadata [9,020 B]                                         Get:21  jammy-security/restricted amd64 Packages [701 kB]             Get:22  jammy-updates/main Translation-en [210 kB]                                            Get:23  jammy-security/restricted i386 Packages [26.8 kB]                                    Get:24  jammy-security/restricted Translation-en [109 kB]                                            Get:25  jammy-updates/main amd64 DEP-11 Metadata [102 kB]                                                                     Get:26  jammy-updates/main DEP-11 48x48 Icons [33.0 kB]                                                                     Get:27  jammy-updates/main DEP-11 64x64 Icons [51.3 kB]                                                                 Get:28  jammy-updates/main amd64 c-n-f Metadata [13.9 kB]                   Get:29  jammy-updates/restricted amd64 Packages [744 kB]                       Get:30  jammy-security/restricted amd64 c-n-f Metadata [576 B]Get:31  jammy-security/universe amd64 Packages [716 kB]   Get:32  jammy-updates/restricted i386 Packages [27.1 kB]Get:33  jammy-updates/restricted Translation-en [115 kB]     Get:34  jammy-updates/restricted amd64 c-n-f Metadata [576 B]     Get:35  jammy-updates/universe amd64 Packages [899 kB] Get:36  jammy-updates/universe i386 Packages [607 kB]                                                                            Get:37  jammy-security/universe i386 Packages [520 kB]                                                                          Get:38  jammy-updates/universe Translation-en [180 kB]                                                                           Get:39  jammy-security/universe Translation-en [118 kB]                                                                         Get:40  jammy-security/universe amd64 DEP-11 Metadata [18.5 kB]                                                                 Get:41  jammy-security/universe DEP-11 48x48 Icons [15.4 kB]                                                                    Get:42  jammy-security/universe DEP-11 64x64 Icons [24.5 kB]                                                                    Get:43  jammy-security/universe amd64 c-n-f Metadata [14.2 kB]                                                                  Get:44  jammy-security/multiverse amd64 Packages [19.4 kB]                                                                      Get:45  jammy-security/multiverse i386 Packages [1,028 B]                                                                       Get:46  jammy-updates/universe amd64 DEP-11 Metadata [269 kB]                                                                    Get:47  jammy-security/multiverse Translation-en [4,068 B]                                                                      Get:48  jammy-security/multiverse amd64 c-n-f Metadata [228 B]                                                                  Get:49  jammy-updates/universe DEP-11 48x48 Icons [173 kB]                                                                       Get:50  jammy-updates/universe DEP-11 64x64 Icons [267 kB]                                                                       Get:51  jammy-updates/universe amd64 c-n-f Metadata [18.6 kB]                                                                    Get:52  jammy-updates/multiverse amd64 Packages [24.1 kB]                                                                        Get:53  jammy-updates/multiverse i386 Packages [3,500 B]                                                                         Get:54  jammy-updates/multiverse Translation-en [6,312 B]                                                                        Get:55  jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]                                                                   Get:56  jammy-updates/multiverse amd64 c-n-f Metadata [444 B]                                                                    Get:57  jammy-backports/main i386 Packages [33.7 kB]                                                                             Get:58  jammy-backports/main amd64 Packages [40.6 kB]                                                                            Get:59  jammy-backports/main Translation-en [9,800 B]                                                                            Get:60  jammy-backports/main amd64 DEP-11 Metadata [8,004 B]                                                                     Get:61  jammy-backports/main DEP-11 48x48 Icons [7,156 B]                                                                        Get:62  jammy-backports/main DEP-11 64x64 Icons [10.7 kB]                                                                        Get:63  jammy-backports/main DEP-11 64x64@2 Icons [29 B]                                                                         Get:64  jammy-backports/main amd64 c-n-f Metadata [388 B]                                                                        Get:65  jammy-backports/universe i386 Packages [11.5 kB]                                                                         Get:66  jammy-backports/universe amd64 Packages [20.3 kB]                                                                        Get:67  jammy-backports/universe Translation-en [14.4 kB]                                                                        Get:68  jammy-backports/universe amd64 DEP-11 Metadata [12.5 kB]                                                                 Get:69  jammy-backports/universe DEP-11 48x48 Icons [6,973 B]                                                                    Get:70  jammy-backports/universe DEP-11 64x64 Icons [13.4 kB]                                                                    Get:71  jammy-backports/universe amd64 c-n-f Metadata [480 B]                                                                    Fetched 9,292 kB in 10s (937 kB/s)                                                                                                                               Reading package lists... DoneBuilding dependency tree... DoneReading state information... Done469 packages can be upgraded. Run 'apt list --upgradable' to see them.W: : Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.root@vm01:~# apt -y install mysql-community-serverReading package lists... DoneBuilding dependency tree... DoneReading state information... DoneThe following additional packages will be installed:  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core  mysql-community-client-plugins mysql-community-server-coreThe following NEW packages will be installed:  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client mysql-community-client-core  mysql-community-client-plugins mysql-community-server mysql-community-server-core0 upgraded, 11 newly installed, 0 to remove and 469 not upgraded.Need to get 38.2 MB of archives.After this operation, 273 MB of additional disk space will be used.Get:1  jammy/main amd64 libmecab2 amd64 0.996-14build9 [199 kB]Get:2  jammy/main amd64 mecab-utils amd64 0.996-14build9 [4,850 B]Get:3  jammy/main amd64 mecab-ipadic all 2.7.0-20070801+main-3 [6,718 kB]Get:4  jammy/mysql-8.0 amd64 mysql-common amd64 8.0.32-1ubuntu22.04 [68.6 kB]Get:5  jammy/mysql-8.0 amd64 mysql-community-client-plugins amd64 8.0.32-1ubuntu22.04 [1,437 kB]Get:6  jammy/mysql-8.0 amd64 mysql-community-client-core amd64 8.0.32-1ubuntu22.04 [2,184 kB]Get:7  jammy/mysql-8.0 amd64 mysql-community-client amd64 8.0.32-1ubuntu22.04 [2,458 kB]                                         Get:8  jammy/mysql-8.0 amd64 mysql-client amd64 8.0.32-1ubuntu22.04 [67.3 kB]                                                    Get:9  jammy/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.32-1ubuntu22.04 [25.0 MB]                                     Get:10  jammy/main amd64 mecab-ipadic-utf8 all 2.7.0-20070801+main-3 [4,384 B]                                                   Get:11  jammy/mysql-8.0 amd64 mysql-community-server amd64 8.0.32-1ubuntu22.04 [79.1 kB]                                         Fetched 38.2 MB in 31s (1,228 kB/s)                                                                                                                              Preconfiguring packages ...Selecting previously unselected package mysql-common.(Reading database ... 170924 files and directories currently installed.)Preparing to unpack .../00-mysql-common_8.0.32-1ubuntu22.04_amd64.deb ...Unpacking mysql-common (8.0.32-1ubuntu22.04) ...Selecting previously unselected package mysql-community-client-plugins.Preparing to unpack .../01-mysql-community-client-plugins_8.0.32-1ubuntu22.04_amd64.deb ...Unpacking mysql-community-client-plugins (8.0.32-1ubuntu22.04) ...Selecting previously unselected package mysql-community-client-core.Preparing to unpack .../02-mysql-community-client-core_8.0.32-1ubuntu22.04_amd64.deb ...Unpacking mysql-community-client-core (8.0.32-1ubuntu22.04) ...Selecting previously unselected package mysql-community-client.Preparing to unpack .../03-mysql-community-client_8.0.32-1ubuntu22.04_amd64.deb ...Unpacking mysql-community-client (8.0.32-1ubuntu22.04) ...Selecting previously unselected package mysql-client.Preparing to unpack .../04-mysql-client_8.0.32-1ubuntu22.04_amd64.deb ...Unpacking mysql-client (8.0.32-1ubuntu22.04) ...Selecting previously unselected package libmecab2:amd64.Preparing to unpack .../05-libmecab2_0.996-14build9_amd64.deb ...Unpacking libmecab2:amd64 (0.996-14build9) ...Selecting previously unselected package mysql-community-server-core.Preparing to unpack .../06-mysql-community-server-core_8.0.32-1ubuntu22.04_amd64.deb ...Unpacking mysql-community-server-core (8.0.32-1ubuntu22.04) ...Selecting previously unselected package mysql-community-server.Preparing to unpack .../07-mysql-community-server_8.0.32-1ubuntu22.04_amd64.deb ...Unpacking mysql-community-server (8.0.32-1ubuntu22.04) ...Selecting previously unselected package mecab-utils.Preparing to unpack .../08-mecab-utils_0.996-14build9_amd64.deb ...Unpacking mecab-utils (0.996-14build9) ...Selecting previously unselected package mecab-ipadic.Preparing to unpack .../09-mecab-ipadic_2.7.0-20070801+main-3_all.deb ...Unpacking mecab-ipadic (2.7.0-20070801+main-3) ...Selecting previously unselected package mecab-ipadic-utf8.Preparing to unpack .../10-mecab-ipadic-utf8_2.7.0-20070801+main-3_all.deb ...Unpacking mecab-ipadic-utf8 (2.7.0-20070801+main-3) ...Setting up libmecab2:amd64 (0.996-14build9) ...Setting up mysql-common (8.0.32-1ubuntu22.04) ...update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto modeSetting up mysql-community-server-core (8.0.32-1ubuntu22.04) ...Setting up mecab-utils (0.996-14build9) ...Setting up mysql-community-client-plugins (8.0.32-1ubuntu22.04) ...Setting up mecab-ipadic (2.7.0-20070801+main-3) ...Compiling IPA dictionary for Mecab.  This takes long time...reading /usr/share/mecab/dic/ipadic/unk.def ... 40emitting double-array: 100% |###########################################| /usr/share/mecab/dic/ipadic/model.def is not found. skipped.reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202reading /usr/share/mecab/dic/ipadic/Others.csv ... 2reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27328reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91emitting double-array: 100% |###########################################| reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316emitting matrix      : 100% |###########################################| done!update-alternatives: using /var/lib/mecab/dic/ipadic to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto modeSetting up mysql-community-client-core (8.0.32-1ubuntu22.04) ...Setting up mecab-ipadic-utf8 (2.7.0-20070801+main-3) ...Compiling IPA dictionary for Mecab.  This takes long time...reading /usr/share/mecab/dic/ipadic/unk.def ... 40emitting double-array: 100% |###########################################| /usr/share/mecab/dic/ipadic/model.def is not found. skipped.reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202reading /usr/share/mecab/dic/ipadic/Others.csv ... 2reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27328reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91emitting double-array: 100% |###########################################| reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316emitting matrix      : 100% |###########################################| done!update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto modeSetting up mysql-community-client (8.0.32-1ubuntu22.04) ...Setting up mysql-client (8.0.32-1ubuntu22.04) ...Setting up mysql-community-server (8.0.32-1ubuntu22.04) ...update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto modeCreated symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.Processing triggers for man-db (2.10.2-1) ...Processing triggers for libc-bin (2.35-0ubuntu3) ...root@vm01:~# systemctl start mysql

安装过程中会提示输入管理员root密码和密码加密方式。

至此, 在Centos7和Ubuntu22.04上使用官方源自动下载安装MySQL就结束了, 比较简单方便。

和先下载安装包再本地安装差别就是要先装一个源的包,然后直接安装MySQL就行了。比较适合测试环境,测试环境可以联网。

大部分生产环境还是网络隔绝的,只能是先下载上传安装包再本地安装了。

谢谢,觉得不错请关注防丢失。9de7bb31d0644e7393039222babfed10

标签: #debian8mysql