事先从官网下载RPM安装包,上传至服务器:
[root@node2 ~]# ls -l mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 root root 545894400 Mar 27 22:31 mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
解压查看:
[root@node2 ~]# tar xf mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
[root@node2 ~]# ls -l mysql-community-*
-rw-r--r-- 1 7155 31415 26670472 Dec 16 10:01 mysql-community-client-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 318884 Dec 16 10:01 mysql-community-common-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 4122424 Dec 16 10:01 mysql-community-devel-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 47760004 Dec 16 10:02 mysql-community-embedded-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 23316972 Dec 16 10:02 mysql-community-embedded-compat-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 132204460 Dec 16 10:02 mysql-community-embedded-devel-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2474780 Dec 16 10:02 mysql-community-libs-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 1264836 Dec 16 10:02 mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 182274360 Dec 16 10:02 mysql-community-server-5.7.37-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 125477564 Dec 16 10:03 mysql-community-test-5.7.37-1.el7.x86_64.rpm
其中:
mysql-community-client 客户端
mysql-community-devel 开发库
mysql-community-common 服务端和客户端的公共文件
mysql-community-embedded 嵌入式
mysql-community-serve 服务端
mysql-community-test 测试组件
mysql-community-libs 共享库
mysql-community-libs-compat MySQL之前版本的共享兼容库
安装:
首先限制mariadb相关软件包。
[root@node2 ~]# yum remove mariadb-libs -y
# 安装
[root@node2 ~]# rpm -ivh mysql-community-client-5.7.37-1.el7.x86_64.rpm
mysql-community-common-5.7.37-1.el7.x86_64.rpm \
mysql-community-libs-5.7.37-1.el7.x86_64.rpm \
mysql-community-server-5.7.37-1.el7.x86_64.rpm
设计开机自启并启动
[root@node2 ~]# systemctl enable --now mysqld
登陆
[root@node2 ~]# tmp_pwd=`awk '/temporary password/ {print $NF}' /var/log/mysqld.log`
[root@node2 ~]# mysql -uroot -p$tmp_pwd
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: 5.7.37 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, 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>