systemctl stop firewalld.service
systemctl disable firewalld.service
vim /etc/selinux/config
将SELINUX=enforcing 改为SELINUX=disabled
SELINUX=disabled
先卸载linux自带的mariadb数据库:
rpm -qa | grep mariadb | xargs rpm -e --nodeps
然后用 yum安装wget工具:
yum install -y wget
用wget下载mysql包:
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
安装yum源:
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum -y install mysql-server
启动mysql服务:
systemctl start mysqld
查看mysql密码:
grep ‘temporary password’ /var/log/mysqld.log
执行mysql初始化脚本:
mysql_secure_installation
输入新密码(至少12个字符,至少包含一个大写字母有,一个小写字母,一个数字,一个特殊字符):
配置root用户远程访问权限:
grant all privileges on . to ‘root’ @’%’ identified by ‘你刚才设置的密码’;
刷新策略:
flush privileges;