当前位置:网站首页>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
边栏推荐
- Detailed explanation of Pointer use
- Cubemx DMA notes
- 从数组中找出和为目标的下标
- 6.网络-基础
- 黑马笔记---Map集合体系
- 7. Eleven state sets of TCP
- About PROFIBUS: communication backbone network of production plant
- Fabric.js 更换图片的3种方法(包括更换分组内的图片,以及存在缓存的情况)
- Mapping settings in elk (8) es
- Global and Chinese market of insulin pens 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

Video multiple effects production, fade in effect and border background are added at the same time

kmp思想及模板代码

Black Horse Notes - - set Series Collection

Line by line explanation of yolox source code of anchor free series network (7) -- obj in head_ loss、Cls_ Loss and reg_ Calculation and reverse transmission of loss I

Dark horse notes -- Set Series Collection

Creation and destruction of function stack frames

Fabric. JS compact JSON

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

Mathematical knowledge -- understanding and examples of fast power

The El cascader echo only selects the questions that are not displayed
随机推荐
7.TCP的十一种状态集
Fabric.js 背景不受视口变换影响
黑馬筆記---Set系列集合
Gee: explore the characteristics of precipitation change in the Yellow River Basin in the past 10 years [pixel by pixel analysis]
Pycharm breakpoint management: temporarily cancel some breakpoints + run directly to a line
Principle and implementation of parallax effect
Gee series: unit 8 time series analysis in Google Earth engine [time series]
【pyinstaller】_get_sysconfigdata_name() missing 1 required positional argument: ‘check_exists‘
Black Horse Notes - - set Series Collection
Domestic all Chinese automatic test software apifox
Nodejs (02) - built in module
Gee: remote sensing image composite and mosaic
Fabric. JS activation input box
There are duplicate elements in leetcode. Go implementation
Online English teaching app open source platform (customized)
Global and Chinese market of cell culture freezers 2022-2028: Research Report on technology, participants, trends, market size and share
LeetCode 1175. Prime number arrangement (prime number judgment + Combinatorial Mathematics)
2022 Alibaba global mathematics competition, question 4, huhushengwei (blind box problem, truck problem) solution ideas
Fabric.js 将本地图像上传到画布背景
Line by line explanation of yolox source code of anchor free series network (7) -- obj in head_ loss、Cls_ Loss and reg_ Calculation and reverse transmission of loss I