centos7和centos8安装mysql5.6 5.7 8.0原来这么简单

2022-08-10 17:30:58 浏览数 (1)

https://dev.mysql.com/downloads/repo/yum/

注意构造下http://repo.mysql.com/mysql-community-release-el*-*.noarch.rpm

【以centos7为例】

安装mysql5.6

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum install mysql-server -y

service mysqld start

service mysqld status

systemctl enable mysqld.service

grep "password" /var/log/mysqld.log找初始密码,如果报找不到文件那就试试grep "password" /var/log/mysql/mysqld.log

mysqladmin -uroot -p password NewPassword回车输入初始密码来重置密码

安装mysql5.7

wget http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm

rpm -ivh mysql57-community-release-el7-11.noarch.rpm

yum install mysql-server -y

service mysqld start

service mysqld status

systemctl enable mysqld.service

grep "password" /var/log/mysqld.log找初始密码,如果报找不到文件那就试试grep "password" /var/log/mysql/mysqld.log

mysqladmin -uroot -p password NewPassword回车输入初始密码来重置密码

安装mysql8.0

wget http://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

rpm -ivh mysql80-community-release-el7-3.noarch.rpm

yum install mysql-server -y

service mysqld start

service mysqld status

systemctl enable mysqld.service

grep "password" /var/log/mysql/mysqld.log找初始密码,如果报找不到文件那就试试grep "password" /var/log/mysqld.log

mysqladmin -uroot -p password NewPassword回车输入初始密码来重置密码

为了下载速度快一些,如果是centos7可以替换URL为腾讯源地址(腾讯云上面没有centos8和centos9)

具体地址需自行打开如下URL找到精确URL

http://mirrors.tencent.com/mysql/yum/

如果服务器是腾讯云的,则可以替换公网域名为内网域名,这样更快

  • 公网域名:mirrors.cloud.tencent.com或mirrors.tencent.com
  • 内网域名:mirrors.tencentyun.com

0 人点赞