CentOS 7安装MySQL 5.7

下载repo

curl https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm --output mysql80-community-release-el7-3.noarch.rpm

安装repo

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

禁用8.0启用5.7

vim /etc/yum.repos.d/mysql-community.repo

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

刷新缓存

yum makecache

安装

yum install mysql-community-server -y

启动

systemctl start mysqld

设置开机启动

systemctl enable mysqld

查看默认密码

less /var/log/mysql.log

A temporary password is generated for root@localhost: 2rFw90IqzO/E

用临时密码登陆mysql

mysql -uroot -p

修改密码

mysql> set password for root@localhost = password(‘Aa122333!‘);

官方安装文档

https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

CentOS 7安装MySQL 5.7

上一篇:ajax文件上传进度监听


下一篇:批量操作数据库