#####1,到http://dev.mysql.com/downloads/repo/yum/下载yum源 wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm #####2,安装yum源,替换系统默认的@R_502_198@源 yum localinstall @R_502_198@57-community-release-el7-11.noarch.rpm #####3,验证@R_502_198@源是否添加成功 yum repolist enabled | grep "@R_502_198@.-community." #####4,查看所有@R_502_198@的发行版本列表 yum repolist all | grep @R_502_198@ #####5,禁用5.7,安装5.6执行如下命令 yum-config-manager --disable @R_502_198@57-community yum-config-manager --enable @R_502_198@56-community #####6,步骤5也可以编辑/etc/yum.repos.d/@R_502_198@-community.repo文件,达到启用禁用 默认5.7的文件 [@R_502_198@57-community] name=@R_502_198@ 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 修改成5.6的 # Enable to use @R_502_198@ 5.6 [@R_502_198@56-community] name=@R_502_198@ 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
最后执行repolist enabled | grep @R_502_198@是修改生效
#####7,安装@R_502_198@ yum install @R_502_198@-community-server 注意:同时也安装了@R_502_198@-community-client,@R_502_198@-community-common,@R_502_198@-community-libs这三个组件 #####8,启动@R_502_198@服务 service @R_502_198@d start #####9,检查@R_502_198@服务状态 service @R_502_198@d status #####10,@R_502_198@初始化时会生成一个临时密码(Pr,KL=?ab7y/),密码为 grep 'temporary password' /var/log/@R_502_198@d.log #####11,修改密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'RestyleTest@2017'; 注意:密码要包含一个大写字符,一个小写字符,数字,特殊字符,不少于8位. #####12,授权root用户可以远程登录访问 GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '新的密码' WITH GRANT OPTION; FLUSH PRIVILEGES; #####13,查看默认编码 show variables like '%character%'; #####14,配置默认编码为utf8 vi /etc/my.cnf [@R_502_198@d] character_set_server=utf8 init_connect='SET NAMES utf8' #####15,重启@R_502_198@服务 systemctl restart @R_502_198@d #####16,关闭防火墙或禁用防火墙对3306端口的拦截 vi /etc/sysconfig/iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT service iptables restart
原文链接:https://www.f2er.com/centos/376279.html