centos7 安装mysql7(不适用于生产环境)

卸载mysql

rpm -qa|grep -i mysql

rpm -ev mysql-community-client-5.6.46-2.el7.x86_64 --nodeps

rpm -ev mysql80-community-release-el7-3.noarch --nodeps

rpm -ev mysql-community-server-5.6.46-2.el7.x86_64 --nodeps

rpm -ev MySQL-python-1.2.5-1.el7.x86_64 --nodeps

rpm -ev mysql-community-libs-5.6.46-2.el7.x86_64 --nodeps

find / -name mysql

观察如果是 mysql 的目录手动删除

(其他不相关的软件在 check 的时候会冲突, 都可以参照这个方法清理)

安装:

Mysql 5.7 安装操作手册:

MySQL :: A Quick Guide to Using the MySQL Yum Repository

Mysql 5.7 rpm 源:

https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.39-1.el7.x86_64.rpm

依赖:

https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-libs-5.7.39-1.el7.x86_64.rpm

https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.39-1.el7.x86_64.rpm

https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-common-5.7.39-1.el7.x86_64.rpm

yum install mysql-community-common-5.7.39-1.el7.x86_64.rpm

yum install mysql-community-libs-5.7.39-1.el7.x86_64.rpm

yum install mysql-community-client-5.7.39-1.el7.x86_64.rpm

yum install mysql-community-server-5.7.39-1.el7.x86_64.rpm

启动:

systemctl start mysqld

systemctl status mysqld

找到 root 的默认密码:

grep 'temporary password' /var/log/mysqld.log (/lt.tNiQW9O&)

修改root 密码:

mysql -uroot -p

(Zm12346!) // 安全策略要求有大小写

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Zm12346!';

(密码要符合安全策略:大小写+特殊字符 :ERROR 1819 (HY000): Your password does not satisfy the current policy requirements) flush privileges;

授权远程登录:

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

端口配置

netstat -tulpen |grep msyql

必需要有 3306 端口, 和 0.0.0.0 : 0 0.0.0.0:3306

vi /etc/my.cnf

添加 bind-address = 0.0.0.0

systemctl restart mysqld

防火墙:

查看列表:

sudo firewall-cmd --list-all

添加到 firewall :

sudo firewall-cmd --zone=public --permanent --add-service=mysql

systemctl restart firewalld

用户名/密码

root/Zm12346!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爬上树顶

打赏可验证我能否靠此文财务自由

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值