操作系统最小化安装

安装步骤 1 检查系统是否有安装包和mysql源

  1. yum install mysql-community-client mysql-community-server

实例:

  1. [root@riyimei ~]# yum install mysql-community-client mysql-community-server
  2. Loaded plugins: fastestmirror, versionlock
  3. Determining fastest mirrors
  4. * base: mirrors.ustc.edu.cn
  5. * extras: mirrors.aliyun.com
  6. * updates: mirrors.ustc.edu.cn
  7. base | 3.6 kB 00:00:00
  8. docker-ce-stable | 3.5 kB 00:00:00
  9. epel | 4.7 kB 00:00:00
  10. extras | 2.9 kB 00:00:00
  11. updates | 2.9 kB 00:00:00
  12. (1/6): epel/x86_64/group_gz | 96 kB 00:00:00
  13. (2/6): docker-ce-stable/7/x86_64/primary_db | 75 kB 00:00:00
  14. (3/6): epel/x86_64/updateinfo | 1.0 MB 00:00:02
  15. (4/6): extras/7/x86_64/primary_db | 246 kB 00:00:03
  16. (5/6): epel/x86_64/primary_db | 7.0 MB 00:00:12
  17. (6/6): updates/7/x86_64/primary_db | 15 MB 00:00:20
  18. Excluding 3 updates due to versionlock (use "yum versionlock status" to show them)
  19. No package mysql-community-client available.
  20. No package mysql-community-server available.

报错信息:

  1. No package mysql-community-client available.
  2. No package mysql-community-server available.

处理:添加mysql官方yum源 通过rpm包安装官方源
https://dev.mysql.com/downloads/repo/yum/
下载对应操作系统版本的rpm包
1651120703(1).png

1651122397(1).png
上传rpm包到系统

1651120763(1).png

步骤2 安装MySQL yum源rpm包

mysql80-community-release-el7-6.noarch.rpm
查看文件和yum源

  1. [root@riyimei ~]# ls -l
  2. total 1357672
  3. drwxr-xr-x. 2 root root 161 Nov 9 09:01 alpine
  4. -rw-------. 1 root root 1405 Jul 8 2021 anaconda-ks.cfg
  5. -rw-r--r--. 1 root root 1949 Jul 13 2021 docker.sh
  6. -rw-r--r--. 1 root root 11288 Apr 28 12:30 mysql80-community-release-el7-6.noarch.rpm
  7. -rw-------. 1 root root 130625536 Jul 19 2021 nginx.tag.gz
  8. drwxr-xr-x. 3 root root 65 Jul 19 2021 node
  9. -rw-------. 1 root root 932485632 Jul 19 2021 node.tag.gz
  10. drwxr-xr-x. 4 root root 179 Dec 7 14:00 opsant
  11. -rw-------. 1 root root 327122944 Jul 16 2021 seate-server.tag.gz
  12. [root@riyimei ~]# ls -l /etc/yum.repos.d/
  13. total 40
  14. -rw-r--r--. 1 root root 1664 Nov 23 2018 CentOS-Base.repo
  15. -rw-r--r--. 1 root root 1309 Nov 23 2018 CentOS-CR.repo
  16. -rw-r--r--. 1 root root 649 Nov 23 2018 CentOS-Debuginfo.repo
  17. -rw-r--r--. 1 root root 314 Nov 23 2018 CentOS-fasttrack.repo
  18. -rw-r--r--. 1 root root 630 Nov 23 2018 CentOS-Media.repo
  19. -rw-r--r--. 1 root root 1331 Nov 23 2018 CentOS-Sources.repo
  20. -rw-r--r--. 1 root root 5701 Nov 23 2018 CentOS-Vault.repo
  21. -rw-r--r--. 1 root root 2081 Dec 7 13:24 docker-ce.repo
  22. -rw-r--r--. 1 root root 664 Dec 7 13:24 epel.repo

安装mysql yum源

  1. [root@riyimei ~]# rpm -ivh mysql80-community-release-el7-6.noarch.rpm
  2. warning: mysql80-community-release-el7-6.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
  3. Preparing... ################################# [100%]
  4. Updating / installing...
  5. 1:mysql80-community-release-el7-6 ################################# [100%]

检查yum源和更新 yum repolist

  1. [root@riyimei ~]# yum repolist
  2. Loaded plugins: fastestmirror, versionlock
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.ustc.edu.cn
  5. * extras: mirrors.aliyun.com
  6. * updates: mirrors.ustc.edu.cn
  7. mysql-connectors-community | 2.6 kB 00:00:00
  8. mysql-tools-community | 2.6 kB 00:00:00
  9. mysql80-community | 2.6 kB 00:00:00
  10. (1/3): mysql-tools-community/x86_64/primary_db | 86 kB 00:00:01
  11. (2/3): mysql80-community/x86_64/primary_db | 211 kB 00:00:03
  12. (3/3): mysql-connectors-community/x86_64/primary_db | 87 kB 00:00:07
  13. Excluding 3 updates due to versionlock (use "yum versionlock status" to show them)
  14. repo id repo name status
  15. base/7/x86_64 CentOS-7 - Base 10,072
  16. docker-ce-stable/7/x86_64 Docker CE Stable - x86_64 150
  17. epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,751
  18. extras/7/x86_64 CentOS-7 - Extras 509
  19. mysql-connectors-community/x86_64 MySQL Connectors Community 192
  20. mysql-tools-community/x86_64 MySQL Tools Community 90
  21. mysql80-community/x86_64 MySQL 8.0 Community Server 343
  22. updates/7/x86_64 CentOS-7 - Updates 3,728
  23. repolist: 28,835

步骤3 yum安装mysql

  1. [root@riyimei ~]# yum install mysql-community-client mysql-community-server
  2. Loaded plugins: fastestmirror, versionlock
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.ustc.edu.cn
  5. * extras: mirrors.aliyun.com
  6. * updates: mirrors.ustc.edu.cn
  7. Excluding 3 updates due to versionlock (use "yum versionlock status" to show them)
  8. Resolving Dependencies
  9. --> Running transaction check
  10. ---> Package mariadb.x86_64 1:5.5.68-1.el7 will be obsoleted
  11. ---> Package mysql-community-client.x86_64 0:8.0.29-1.el7 will be obsoleting
  12. --> Processing Dependency: mysql-community-client-plugins = 8.0.29-1.el7 for package: mysql-community-client-8.0.29-1.el7.x86_64
  13. --> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.29-1.el7.x86_64
  14. ---> Package mysql-community-server.x86_64 0:8.0.29-1.el7 will be installed
  15. --> Processing Dependency: mysql-community-common(x86-64) = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
  16. --> Processing Dependency: mysql-community-icu-data-files = 8.0.29-1.el7 for package: mysql-community-server-8.0.29-1.el7.x86_64
  17. --> Running transaction check
  18. ---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
  19. --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
  20. --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
  21. ---> Package mysql-community-client-plugins.x86_64 0:8.0.29-1.el7 will be installed
  22. ---> Package mysql-community-common.x86_64 0:8.0.29-1.el7 will be installed
  23. ---> Package mysql-community-icu-data-files.x86_64 0:8.0.29-1.el7 will be installed
  24. ---> Package mysql-community-libs.x86_64 0:8.0.29-1.el7 will be obsoleting
  25. --> Running transaction check
  26. ---> Package mysql-community-libs-compat.x86_64 0:8.0.29-1.el7 will be obsoleting
  27. ---> Package postfix.x86_64 2:2.10.1-7.el7 will be updated
  28. ---> Package postfix.x86_64 2:2.10.1-9.el7 will be an update
  29. --> Finished Dependency Resolution
  30. Dependencies Resolved
  31. ============================================================================================================================================================================================
  32. Package Arch Version Repository Size
  33. ============================================================================================================================================================================================
  34. Installing:
  35. mysql-community-client x86_64 8.0.29-1.el7 mysql80-community 14 M
  36. replacing mariadb.x86_64 1:5.5.68-1.el7
  37. mysql-community-libs x86_64 8.0.29-1.el7 mysql80-community 1.5 M
  38. replacing mariadb-libs.x86_64 1:5.5.68-1.el7
  39. mysql-community-libs-compat x86_64 8.0.29-1.el7 mysql80-community 667 k
  40. replacing mariadb-libs.x86_64 1:5.5.68-1.el7
  41. mysql-community-server x86_64 8.0.29-1.el7 mysql80-community 53 M
  42. Installing for dependencies:
  43. mysql-community-client-plugins x86_64 8.0.29-1.el7 mysql80-community 2.5 M
  44. mysql-community-common x86_64 8.0.29-1.el7 mysql80-community 633 k
  45. mysql-community-icu-data-files x86_64 8.0.29-1.el7 mysql80-community 2.1 M
  46. Updating for dependencies:
  47. postfix x86_64 2:2.10.1-9.el7 base 2.4 M
  48. Transaction Summary
  49. ============================================================================================================================================================================================
  50. Install 4 Packages (+3 Dependent packages)
  51. Upgrade ( 1 Dependent package)
  52. Total download size: 77 M
  53. Is this ok [y/d/N]: y
  54. Downloading packages:
  55. Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
  56. warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY MB 00:03:52 ETA
  57. Public key for mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm is not installed
  58. (1/8): mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm | 2.5 MB 00:00:14
  59. (2/8): mysql-community-common-8.0.29-1.el7.x86_64.rpm | 633 kB 00:00:04
  60. (3/8): mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm | 2.1 MB 00:00:13
  61. (4/8): mysql-community-libs-8.0.29-1.el7.x86_64.rpm | 1.5 MB 00:00:11
  62. (5/8): mysql-community-libs-compat-8.0.29-1.el7.x86_64.rpm | 667 kB 00:00:07
  63. (6/8): postfix-2.10.1-9.el7.x86_64.rpm | 2.4 MB 00:00:02
  64. (7/8): mysql-community-client-8.0.29-1.el7.x86_64.rpm 37% [=========================- ] 56 kB/s | 29 MB 00:14:40 ETA
  65. Channel(Socket) closed from remote host(192.168.31.140:22) at 12:35:44.

步骤4 启动数据库并查看端口