前置准备
root 环境下执行
# 关闭selinux
vi /etc/selinux/config
# SELINUX=enforcing =>SELINUX=disabled
# 开通防火墙3306/tcp
firewall-cmd --permanent --add-port=3306/tcp
下载链接获取
下载&安装
下载
mkdir -p /usr/local/mysql
cd /usr/local/mysql
wget https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-8.4.1-1.el7.x86_64.rpm-bundle.tar
解压并安装
# 解压
tar -xvf mysql-8.4.1-1.el7.x86_64.rpm-bundle.tar
# 安装
rpm -ivh *.rpm --force --nodeps
启动mysqld
# 启动
systemctl start mysqld
# 停止
systemctl status mysqld
# 关闭
systemctl stop mysqld
# 开机自启
systemctl enable mysqld
修改密码
- 查找随机密码
grep 'temporary password' /var/log/mysqld.log
- 登陆
mysql -u root -p
# 登陆后
ALTER USER 'root'@'localhost' IDENTIFIED BY 'xsnx&^*SA^X*&()';
# 更改密码安全等级(密码策略、密码长度),按需修改
set global validate_password.policy=LOW;
set global validate_password.length=6;
# 开启root远程登录
use mysql;
select host, user from user;
update user set host = '%' where user = 'root';
# 退出
exit
# 重启服务
systemctl restart mysqld
原味链接https://blog.csdn.net/m0_47333020/article/details/139725406
标签:8.4,--,Mysql,Centos7.9,systemctl,mysqld,mysql,root From: https://www.cnblogs.com/paylove/p/18287011