当前位置:网站首页>centos8安装mysql8.0.22教程
centos8安装mysql8.0.22教程
2022-07-02 05:18: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
边栏推荐
- Nodejs (02) - built in module
- Johnson–Lindenstrauss Lemma(2)
- Gee series: unit 10 creating a graphical user interface using Google Earth engine [GUI development]
- Gee data set: export the distribution and installed capacity of hydropower stations in the country to CSV table
- Map in JS (including leetcode examples)
- leetcode两数相加go实现
- 2022阿里巴巴全球数学竞赛 第4题 虎虎生威(盲盒问题、集卡问题)解决思路
- C # picture display occupancy problem
- 2022 Alibaba global mathematics competition, question 4, huhushengwei (blind box problem, truck problem) solution ideas
- Implementation of leetcode two number addition go
猜你喜欢
![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]

Pycharm breakpoint management: temporarily cancel some breakpoints + run directly to a line

Operator details

Nodejs (02) - built in module

数据的储存

Disable access to external entities in XML parsing

C case of communication between server and client based on mqttnet

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

Fabric. JS compact JSON

Gee series: Unit 2 explore datasets
随机推荐
Fabric.js 背景不受视口变换影响
Global and Chinese markets for marine selective catalytic reduction systems 2022-2028: Research Report on technology, participants, trends, market size and share
黑马笔记---Map集合体系
7.1模擬賽總結
Dark horse notes -- Set Series Collection
[opencv] image binarization
操作符详解
Splice characters in {{}}
Video multiple effects production, fade in effect and border background are added at the same time
黑馬筆記---Set系列集合
Fabric. JS compact JSON
Thread pool batch processing data
Fabric.js IText 上标和下标
Fabric.js 渐变
Domestic all Chinese automatic test software apifox
Fabric. JS 3 APIs to set canvas width and height
函数栈帧的创建和销毁
Gee dataset: chirps pentad high resolution global grid rainfall dataset
国产全中文-自动化测试软件Apifox
7. Eleven state sets of TCP