1.centos7下安裝mysql
linux下mysql安裝包快速下載
鏈接: https://pan.baidu.com/s/1eEvgRCAf540bWAM52icVAw 提取碼: 9jv0
官網下載鏈接:https://downloads.mysql.com/archives/community/
選擇社區下載 MySQL Community Server (Archived Versions)
Operating System:ret hat
os看自己安裝的系統版本
這里我選擇的RPM Bundle :(mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar)
2.利用Sftp命令將安裝包從win7上傳到linux
alt +p #快速打開SFTP傳輸窗口
put -r D:\100_day_test\centos7_mysql\ #傳輸整個文件里的文件
3.安裝前提:
3.1檢查系統自帶的Mysql,並卸載自帶的版本
查看:yum list installed |grep mysql
卸載依賴:yum -y remove mysql-libs.x86_64
3.2更新rpm源:
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm --no-check-certificate
3.3安裝本地mysql源
yum localinstall mysql-community-release-el6-5.noarch.rpm
3.4驗證是否安裝成功
yum repolist all | grep mysql
3.5修改默認版本為5.7
方法1:
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
方法2:
編輯配置文件
vi /etc/yum.repos.d/mysql-community.repo
把mysql5.6的enabled=0
把mysql5.7的enabled=1
保存退出
4.安裝mysql
yum install mysql-community-server
5.出現一下錯誤:
Error: Package: mysql-community-server-5.7.29-1.el6.x86_64 (mysql57-community-dmr)
Requires: libsasl2.so.2()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
6.解決方案
修改vim /etc/yum.repos.d/mysql-community.repo 源文件
這里注意,出現這個錯誤卸載重裝不管用,禁用mysql其他版本,只啟用5.7
更改以下2點:
更改:
enabled=0
gpgcheck=0
7.安裝mysql
yum install mysql-community-server
8.mysql安裝完成。