centOS7.9安装mysql5.7
1.wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2.rpm -ivh mysql80-community-release-el8-4.noarch.rpm
3.# 解决公钥未安装错误,由于版本时间比较长了,不执行这条命令校验不通过
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
4.yum update
5.yum install mysql-server
6.设置 文件夹权限 解决报错: The innodb_system data file 'ibdata1' must be writable
chmod -R 777 /var/lib/mysql
7.初始化 MySQL
mysqld --initialize
8.启动
systemctl start mysqld
9.查看默认密码
grep 'temporary password' /var/log/mysqld.log
显示 [Note] A temporary password is generated for root@localhost: lA*h?a(e9lTi
10.初次登录修改密码 先登录
mysql -u root -p
ALTER USER USER() IDENTIFIED BY '123456';
flush privileges;
11.#允许其他机器连接 先登录
mysql -u root -p
update user set Host='%' where User='root';
flush privileges;