# 查看yum是否安装过mysql
yum list installed mysql*
// 如果有 则依次删除 清理干净
yum remove mysql-community-client
rpm -qa | grep -i mysql
rpm -e mysql57-community-release-el7-9.noarch
whereis mysql
rm -rf /usr/bin/mysql
// 获取
wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
sudo rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
// 安装
yum install mysql-community-server
// 启动
systemctl start mysqld.service
systemctl status mysqld.service
// 获取安装的默认密码
grep 'temporary password' /var/log/mysqld.log
// 连接MySQL
mysql -uroot -p
// 修改默认密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '1@3$qWeR';
// 切换数据库
use mysql
// 允许远程连接
update user set host='%' where user='root';
// 查看 user
select host,user,plugin from user;
// 修改密码强度策略
// 查看
SHOW VARIABLES like 'validate_password%';
// 修改
set global validate_password.policy=0;
set global validate_password.length=4;
set global validate_password.check_user_name=0;
// 将密码修改为简单密码
ALTER USER 'root'@'%' IDENTIFIED BY 'root';
# Navicat 15
# select host,user,plugin from user;
# update user set plugin='mysql_native_password' where user='root';
#ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
// 查看防护墙状态
systemctl status firewalld
// 开启防火墙
systemctl start firewalld
开启防火墙 3306 端口 允许访问 MySQL
firewall-cmd --zone=public --add-port=3306/tcp --permanent
// 重新加载防火墙配置
firewall-cmd --reload
// --permanent 永久生效,没有此参数重启后失效
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --query-port=80/tcp
firewall-cmd --zone=public --remove-port=80/tcp --permanent
网友评论