centos8安裝mysql8.0.22
阿新 • • 發佈:2021-08-03
1,輸入:
wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
2、安裝資料來源
然後輸入:yum install mysql80-community-release-el8-1.noarch.rpm
3.
檢視mysql源是否安裝成功:yum repolist enabled | grep "mysql.*-community.*"
4.禁用CentOS8自帶的mysql模組
yum module disable mysql
5.真正安裝mysql
yum install mysql-community-server
6.啟動mysql
輸入:
service mysqld start
service mysqld status
7.顯示mysql的隨機密碼
輸入:grep 'temporary password' /var/log/mysqld.log
8.登入並修改mysql密碼
登入:mysql -u root -p
然後輸入上面生成的密碼
9.修改密碼
修改密碼:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root_21root';
檢視密碼策略:SHOW VARIABLES LIKE 'validate_password%';
修改密碼長度:setglobal validate_password.length=1;(長度) 修改密碼等級:set global validate_password.policy=0;(等級)
10.設定自己想要的密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
11.Mysql8.0.22開放遠端訪問
真確寫法: 1、先建立許可權記錄:create user 'root'@'%' identified by 'root123'; 2、授權:grant all privileges on *.* to 'root'@'%' with grant option; 兩句話分開寫:
12.開放防火牆埠
.....
13.
sqlyog連線的坑
本地去連線mysql時報錯,錯誤 2058 Plugin caching_sha2_password could not be loaded
由於mysql8.0的加密方法變了。mysql8.0預設採用caching_sha2_password的加密方式。sqlyog不支援這種加密方式。
1、修改密碼過期 ALTER USER'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER; 2、重新修改密碼 ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; 3、重新整理許可權(不做可能無法生效) FLUSH PRIVILEGES;