Mysql 8.4 安裝(Centos7.9)

一个小笨蛋發表於2024-07-06

前置準備

root 環境下執行

# 關閉selinux 
vi /etc/selinux/config
# SELINUX=enforcing =>SELINUX=disabled
# 開通防火牆3306/tcp
firewall-cmd --permanent --add-port=3306/tcp

下載連結獲取

https://dev.mysql.com/downloads/file/?id=529414
image

下載&安裝

下載

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

image

啟動mysqld

# 啟動
systemctl start mysqld
# 停止
systemctl status mysqld
# 關閉
systemctl stop mysqld
# 開機自啟
systemctl enable mysqld

修改密碼

  • 查詢隨機密碼
grep 'temporary password' /var/log/mysqld.log

image

  • 登陸
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

相關文章