当前位置:网站首页>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
边栏推荐
- 创新永不止步——nVisual网络可视化平台针对Excel导入的创新历程
- Gee series: unit 10 creating a graphical user interface using Google Earth engine [GUI development]
- Thread pool batch processing data
- Principle and implementation of parallax effect
- The reason why sizeof (ARR) / sizeof (arr[0]) is used in the function to calculate the length of the array is incorrect
- Global and Chinese markets for marine selective catalytic reduction systems 2022-2028: Research Report on technology, participants, trends, market size and share
- Fabric. JS 3 APIs to set canvas width and height
- National all Chinese Automatic Test Software apifox
- 函数中使用sizeof(arr) / sizeof(arr[0])求数组长度不正确的原因
- Nodejs (02) - built in module
猜你喜欢
![Gee series: unit 9 generate sampling data in GEE [random sampling]](/img/ff/edb27b40f63eca81c5683e81b2860b.jpg)
Gee series: unit 9 generate sampling data in GEE [random sampling]

Nodejs (03) -- custom module

Fabric. JS compact JSON

About PROFIBUS: communication backbone network of production plant

2022 Alibaba global mathematics competition, question 4, huhushengwei (blind box problem, truck problem) solution ideas

Preparation for writing SAP ui5 applications using typescript

Video cover image setting, put cover images into multiple videos in the simplest way

创新永不止步——nVisual网络可视化平台针对Excel导入的创新历程

Ls1046nfs mount file system

Collectors. Groupingby sort
随机推荐
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
Fabric.js 居中元素
Two implementation methods of delay queue
在{{}}中拼接字符
Record my pytorch installation process and errors
CubeMx DMA笔记
kmp思想及模板代码
Video cover image setting, put cover images into multiple videos in the simplest way
Go implements leetcode rotation array
Nodejs (02) - built in module
Domestic all Chinese automatic test software apifox
Gee data set: export the distribution and installed capacity of hydropower stations in the country to CSV table
Gee: explore the change of water area in the North Canal basin over the past 30 years [year by year]
Gee series: Unit 2 explore datasets
从数组中找出和为目标的下标
Nodejs (03) -- custom module
Gee: create a new feature and set corresponding attributes
视差特效的原理和实现方法
ubuntu20.04安装mysql8
Straighten elements (with transition animation)