当前位置:网站首页>centos8安裝mysql8.0.22教程
centos8安裝mysql8.0.22教程
2022-07-02 05:19:00 【小明哥帶你飛】
安裝步驟如下:
1.卸載
yum remove -y mysql
find / -name mysql //找到殘留的文件,再通過rm -rf去删除對應的文件

2.下載
wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
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 --nogpgcheck

Is this ok [y/Y] 一直 y到底
6.啟動mysql
在啟動mysql時,遇到了一個問題:
[[email protected] soft]# service mysqld start //啟動命令
遇到問題
正確啟動命令:
[[email protected] soft]# /bin/systemctl start mysqld.service//啟動命令
[[email protected] soft]# service mysqld status //

7.顯示mysql的隨機密碼
grep 'temporary password' /var/log/mysqld.log
密碼是host:後面的一串字符。
8.登錄並修改mysql密碼
mysql -u root -p //輸入上面生成的密碼

修改密碼需要注意,這裏密碼先修改成 “Root_21root”
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root_21root'; //因為我們隨便修改密碼時,一般都不滿足它的策略
會報以下錯誤:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
解决辦法:
一定要先修改默認密碼為: Root_21root 滿足它的策略,再進行下面的操作:
SHOW VARIABLES LIKE 'validate_password%'; //查看密碼策略
修改密碼長度:
set global validate_password.length=1; //(長度)
修改密碼等級:
set global validate_password.policy=0; //(等級)
設置成自己想要的密碼:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
修改前策略:
修改後策略:
9.Mysql8.0.22開放遠程訪問
create user 'root'@'%' identified by 'root123'; //1、先創建權限記錄
grant all privileges on *.* to 'root'@'%' with grant option; //2、授權

開放防火牆端口
直接在安全組開放mysql端口號
解决2059 - Authentication plugin ‘caching_sha2_password’ cannot be loaded:
從錯誤信息可知caching_sha2_password不能加載。
以上報錯是由於目前已有的客戶端連接軟件還不支持Mysql8新增加的加密方式caching_sha2_password,所以我們需要修改用戶的加密方式,將其改為老的加密驗證方式。可以看到當前用戶的加密方式為caching_sha2_password。執行以下命令:
use mysql;
select user,plugin from user where user='root';
alter user 'root'@'%' identified with mysql_native_password by '[email protected]';//將用戶的加密方式改為mysql_native_password。
flush privileges;//這個一定要執行,執行命令使權限配置項立即生效。
再次嘗試連接Mysql,連接成功。
示意圖:

轉載:https://blog.csdn.net/qq_39150374/article/details/112471108
边栏推荐
- The El cascader echo only selects the questions that are not displayed
- 黑馬筆記---Set系列集合
- Mysql基础---查询(1天学会mysql基础)
- Exercise notes 13 (effective letter ectopic words)
- 运维工作的“本手、妙手、俗手”
- Map in JS (including leetcode examples)
- Fabric.js 渐变
- 2022 Alibaba global mathematics competition, question 4, huhushengwei (blind box problem, truck problem) solution ideas
- go实现leetcode旋转数组
- Simple and practical accounting software, so that accounts can be checked
猜你喜欢

Using QA band and bit mask in Google Earth engine

7.TCP的十一种状态集

LeetCode 241. 为运算表达式设计优先级(分治/记忆化递归/动态规划)

LeetCode 1175. 质数排列(质数判断+组合数学)

About PROFIBUS: communication backbone network of production plant

LS1046nfs挂载文件系统

Record my pytorch installation process and errors

The El cascader echo only selects the questions that are not displayed

LeetCode 241. Design priorities for operational expressions (divide and conquer / mnemonic recursion / dynamic programming)

Video multiple effects production, fade in effect and border background are added at the same time
随机推荐
Essence and physical meaning of convolution (deep and brief understanding)
Gee: analyze the change of spatial centroid of remote sensing image [centroid acquisition analysis]
Fabric. JS centered element
数据的储存
Mapping settings in elk (8) es
Feign realizes file uploading and downloading
Operator details
Nodejs (03) -- custom module
Case sharing | intelligent Western Airport
Fabric. JS upload local image to canvas background
Map in JS (including leetcode examples)
paddle: ValueError:quality setting only supported for ‘jpeg‘ compression
Global and Chinese market of impact roll 2022-2028: Research Report on technology, participants, trends, market size and share
Using QA band and bit mask in Google Earth engine
从数组中找出和为目标的下标
Storage of data
Implementation of leetcode two number addition go
el form 表单validate成功后没有执行逻辑
Dark horse notes -- map set system
Gee series: Unit 5 remote sensing image preprocessing [GEE grid preprocessing]