1.下载并安装 mysql5.7 的 yum 源

wget http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm
rpm -ivh mysql57-community-release-el6-8.noarch.rpm

2.yum 安装 mysql5.7

yum install -y mysql-community-server

3.第二步如果遇到报错信息:Error:Unable to find a match: mysql-community-server,使用以下方式解决(禁用本地 mysql 模块后再安装):

yum module disable mysql
yum -y install mysql-community-server

4.如果第三步遇到报错信息: Error: Problem: cannot install the best candidate for the job,解决方案如下:

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

5.打开后,找到 [mysql57-community] 这一块配置(将加粗的两个位置更新一下)
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/

gpgcheck=0

其他问题:
获取 'root'@'localhost' 用户的临时密码:

grep 'temporary password' /var/log/mysqld.log

使用临时密码登录后,修改 'root'@'localhost' 的密码

alter user 'root'@'localhost' identified by 'Abc@123456';

授予任意主机远程连接此 mysql 服务器的所有权限

grant all privileges on *.* to 'root'@'%' identified by 'Abc@123456' with grant option;

标签: centos, mysql

评论已关闭