- yum -y install wget
- wget https://repo.mysql.com/mysql80-community-release-el7-4.noarch.rpm
具体下载什么版本可以从下面链接查找:
MySQL :: Download MySQL Yum Repositoryhttps://dev.mysql.com/downloads/repo/yum/
mysql-yum-repositoryhttps://repo.mysql.com/
rpm -ivh mysql80-community-release-el7-4.noarch.rpm
yum install mysql-server
Failing package is:mysql-community-icu-data-files-8.0.29-1.el7.x86_64 GPG Keys are configured as..
如果遇到报错如上报错,则执行下面的命令,原因是mysql的gpg升级了
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
- systemctl start mysqld
-
- 查看服务运行状态
- systemctl status mysqld
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
- ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
-
- 如果设置为简单密码,关闭密码校验规则
- set global validate_password.policy=0;
- set global validate_password.length=1;
-
- CREATE USER `root`@`%` IDENTIFIED BY 'test';
- GRANT ALL ON *.* TO `root`@`%` WITH GRANT OPTION;
- firewall-cmd --zone=public --add-port=3306/tcp --permanent
-
- firewall-cmd --reload