当前位置:网站首页>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
边栏推荐
- Fabric. JS iText sets the color and background color of the specified text
- Here comes the chicken soup! Keep this quick guide for data analysts
- el form 表单validate成功后没有执行逻辑
- How to make an RPM file
- LeetCode 1175. Prime number arrangement (prime number judgment + Combinatorial Mathematics)
- 7.1 Résumé du concours de simulation
- [quick view opencv] familiar with CV matrix operation with image splicing examples (3)
- Global and Chinese market of insulin pens 2022-2028: Research Report on technology, participants, trends, market size and share
- Nodejs (02) - built in module
- 设置滚动条默认样式 谷歌浏览器
猜你喜欢
MySQL foundation --- query (learn MySQL foundation in 1 day)
Mathematical problems (number theory) trial division to judge prime numbers, decompose prime factors, and screen prime numbers
青训营--数据库实操项目
函数栈帧的创建和销毁
Mathematical knowledge -- understanding and examples of fast power
Cubemx DMA notes
6.网络-基础
Fabric. JS right click menu
Collectors.groupingBy 排序
Here comes the chicken soup! Keep this quick guide for data analysts
随机推荐
Gee series: unit 6 building various remote sensing indexes in Google Earth engine
黑马笔记---Set系列集合
Pyechats 1.19 generate a web version of Baidu map
Gee series: unit 7 remote sensing image classification using GEE [random forest classification]
Fasttext text text classification
Online English teaching app open source platform (customized)
Leetcode basic programming: array
Principle and implementation of parallax effect
Case sharing | intelligent Western Airport
Fabric. JS basic brush
Fabric.js 基础笔刷
国产全中文-自动化测试软件Apifox
Leetcode 18 problem [sum of four numbers] recursive solution
Cubemx DMA notes
Fabric.js IText 上标和下标
在{{}}中拼接字符
7. Eleven state sets of TCP
视差特效的原理和实现方法
摆正元素(带过渡动画)
Gee series: Unit 1 Introduction to Google Earth engine