0.提前将防火墙和SELinux服务关闭
临时关闭防火墙(重启后失效)
systemctl stop firewalld.service
永久关闭防火墙
systemctl disable firewalld.service
查看防火墙状态
systemctl status firewalld.service
查看selinux状态
getenforce
说明:Enforcing为启用,Permissive为未启用
临时关闭selinux(重启后失效)
setenforce 0
永久关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
1.下载8.0版本的MySQL的yum存储库,如果你没有安装wget,你可以先使用yum -y install wget来安装它。
wget https://dev.mysql.com/get/mysql80-community-release-el9-3.noarch.rpm
2.安装存储库
rpm -Uvh mysql80-community-release-el9-3.noarch.rpm
3.禁用系统自带的mysql模块
yum module disable mysql
4.安装mysql sever
yum install mysql-community-server
5.启动mysql服务
service mysqld start
6.查看服务状态
service mysqld status
7.查看初始密码
grep 'temporary password' /var/log/mysqld.log
8.登陆MySQL输入上面的密码siv&YhHmJ4Wd
mysql -u root -p
9.修改密码
9.1.修改本地root用户登录密码
alter user 'root'@'localhost' identified by "Q!!weWER1234@";
9.2.创建全域root用户(允许root用户从其它地址访问)
create user 'root'@'%' identified by 'Q!!weWER1234@';
9.2.1.进行授权
grant all privileges on *.* to 'root'@'%';
flush privileges;
update mysql.user set Grant_priv='Y', Super_priv='Y' where user ='root' and host='%';
flush privileges;
10.用可视化工具远程连接
最好使用Navicat工具去连接
11移动数据目录(非必须)
看下面的链接最后
https://www.yuque.com/g/u2228905/rut9ig/bs187d/collaborator/join?token=LphOJZMPy1zmd1B1&source=doc_collaborator# 《Centos7安装Mysql8.0最新版指南》