当前位置:网站首页>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
边栏推荐
- Mathematical knowledge -- understanding and examples of fast power
- Summary of database problems
- Video cover image setting, put cover images into multiple videos in the simplest way
- 函数栈帧的创建和销毁
- 指针使用详解
- Global and Chinese markets of semiconductor laser therapeutics 2022-2028: Research Report on technology, participants, trends, market size and share
- Latest: the list of universities and disciplines for the second round of "double first-class" construction was announced
- Splice characters in {{}}
- Pyechats 1.19 generate a web version of Baidu map
- Basic differences between Oracle and MySQL (entry level)
猜你喜欢
Nodejs (02) - built in module
7. Eleven state sets of TCP
How matlab marks' a 'in the figure and how matlab marks points and solid points in the figure
el form 表单validate成功后没有执行逻辑
Fabric. JS compact JSON
The El cascader echo only selects the questions that are not displayed
Creation and destruction of function stack frames
CubeMx DMA笔记
Fabric.js IText 手动设置斜体
Gee: create a new feature and set corresponding attributes
随机推荐
The reason why sizeof (ARR) / sizeof (arr[0]) is used in the function to calculate the length of the array is incorrect
Disable access to external entities in XML parsing
go实现leetcode旋转数组
Global and Chinese market of insulin pens 2022-2028: Research Report on technology, participants, trends, market size and share
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 3个api设置画布宽高
Gee series: unit 8 time series analysis in Google Earth engine [time series]
数据的储存
Fabric.js 渐变
Database batch insert data
摆正元素(带过渡动画)
Php/js cookie sharing across domains
Black Horse Notes - - set Series Collection
Implementation of go language for deleting duplicate items in sorting array
Operator details
Disable access to external entities in XML parsing
Mathematical knowledge -- understanding and examples of fast power
Pycharm breakpoint management: temporarily cancel some breakpoints + run directly to a line
The El cascader echo only selects the questions that are not displayed
Gee series: Unit 4 data import and export in Google Earth engine