当前位置:网站首页>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
边栏推荐
- Leetcode 18 problem [sum of four numbers] recursive solution
- The El cascader echo only selects the questions that are not displayed
- Gee series: unit 10 creating a graphical user interface using Google Earth engine [GUI development]
- Video cover image setting, put cover images into multiple videos in the simplest way
- Go implements leetcode rotation array
- 数据的储存
- Fabric.js 将本地图像上传到画布背景
- 案例分享|智慧化的西部机场
- LeetCode 241. Design priorities for operational expressions (divide and conquer / mnemonic recursion / dynamic programming)
- Global and Chinese markets for marine selective catalytic reduction systems 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

数据的储存

Collectors. Groupingby sort
![Gee: explore the characteristics of precipitation change in the Yellow River Basin in the past 10 years [pixel by pixel analysis]](/img/ff/59956c2323567cc614458a2bccb642.jpg)
Gee: explore the characteristics of precipitation change in the Yellow River Basin in the past 10 years [pixel by pixel analysis]

Here comes the chicken soup! Keep this quick guide for data analysts

6. Network - Foundation

MySQL foundation --- query (learn MySQL foundation in 1 day)

黑马笔记---Map集合体系
![Gee: explore the change of water area in the North Canal basin over the past 30 years [year by year]](/img/7b/b9ef76cee8b32204331a9c3c21b5c2.jpg)
Gee: explore the change of water area in the North Canal basin over the past 30 years [year by year]

kmp思想及模板代码

7. Eleven state sets of TCP
随机推荐
7.TCP的十一种状态集
LeetCode 1175. Prime number arrangement (prime number judgment + Combinatorial Mathematics)
National all Chinese Automatic Test Software apifox
6.网络-基础
Php/js cookie sharing across domains
Gee series: unit 6 building various remote sensing indexes in Google Earth engine
延时队列两种实现方式
Gee: create a new feature and set corresponding attributes
函数栈帧的创建和销毁
Detailed explanation of Pointer use
Fabric.js 居中元素
Fabric. JS right click menu
【pyinstaller】_ get_ sysconfigdata_ name() missing 1 required positional argument: ‘check_ exists‘
Nodejs (02) - built in module
Fabric.js IText 手动设置斜体
Fabric. JS iText superscript and subscript
Dark horse notes -- Set Series Collection
7.1模拟赛总结
ubuntu20.04安装mysql8
Domestic all Chinese automatic test software apifox