文章目录
- 一、软件安装
- 1. 下载
- 2. 解压
- 3.安装
- 4. 跳过权限
- 5. 启动mysql服务端
- 6. 设置密码
- 7. 允许远程连接
- 8.开发3306端口
- 二、安装报错方案
一、软件安装
1. 下载
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar
https://dev.mysql.com/downloads/mysql/
2. 解压
tar -xvf mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar
解压后的列表:
mysql-5.7.33-1.el7.x86_64.rpm-bundle.tarmysql-community-client-5.7.33-1.el7.x86_64.rpmmysql-community-common-5.7.33-1.el7.x86_64.rpmmysql-community-devel-5.7.33-1.el7.x86_64.rpmmysql-community-embedded-5.7.33-1.el7.x86_64.rpmmysql-community-embedded-compat-5.7.33-1.el7.x86_64.rpmmysql-community-embedded-devel-5.7.33-1.el7.x86_64.rpmmysql-community-libs-5.7.33-1.el7.x86_64.rpmmysql-community-libs-compat-5.7.33-1.el7.x86_64.rpmmysql-community-server-5.7.33-1.el7.x86_64.rpmmysql-community-test-5.7.33-1.el7.x86_64.rpm
3.安装
安装优先级:
rpm -ivh mysql-community-common-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.33-1.el7.x86_64.rpm
4. 跳过权限
# 配置mysql
vim /etc/my.cnf# 在[mysqld]标签下面添加,跳过校验
skip-grant-tables
5. 启动mysql服务端
# 启动mysql服务端
systemctl start mysqld.service# 使用客户端连接server端
mysql,按回车
6. 设置密码
# 设置密码
update mysql.user set authentication_string=password('123456') where user='root';# 刷新权限
flush privileges;
7. 允许远程连接
# 允许远程连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
8.开发3306端口
# 开放端口(开放后需要要重启防火墙才生效)
firewall-cmd --zone=public --add-port=8080/tcp --permanent
# 重新启动防火墙
firewall-cmd --reload
二、安装报错方案
没遇到则可以跳过,
安装报错:
[root@bogon app]# rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm
警告:mysql-community-libs-5.7.33-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:mysql-community-common(x86-64) >= 5.7.9 被 mysql-community-libs-5.7.33-1.el7.x86_64 需要mariadb-libs 被 mysql-community-libs-5.7.33-1.el7.x86_64 取代
[root@bogon app]# ----------------------------------------------------------------
原因是 centos7 默认安装mariadb-libs包,需要卸载# 查看mariadb
[root@bogon app]# rpm -qa |grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64# 卸载mariadb
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64# 跳过签名校验安装mysql(如果遇到签名错误,执行这条命令)
rpm -ivh --force --nodeps mysql-community-libs-5.7.33-1.el7.x86_64.rpm