当前位置:网站首页>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
边栏推荐
- 案例分享|智慧化的西部机场
- 在{{}}中拼接字符
- Leetcode 18 problem [sum of four numbers] recursive solution
- Gee: create a new feature and set corresponding attributes
- Global and Chinese markets of semiconductor laser therapeutics 2022-2028: Research Report on technology, participants, trends, market size and share
- Video cover image setting, put cover images into multiple videos in the simplest way
- 函数中使用sizeof(arr) / sizeof(arr[0])求数组长度不正确的原因
- LS1046nfs挂载文件系统
- Using QA band and bit mask in Google Earth engine
- Pyechats 1.19 generate a web version of Baidu map
猜你喜欢
Paddlepaddle project source code
About PROFIBUS: communication backbone network of production plant
Pyechats 1.19 generate a web version of Baidu map
Fabric. JS upload local image to canvas background
Gee: use of common mask functions in remote sensing image processing [updatemask]
Simple and practical accounting software, so that accounts can be checked
C case of communication between server and client based on mqttnet
Gee series: Unit 2 explore datasets
Pyechart1.19 national air quality exhibition
MySQL foundation --- query (learn MySQL foundation in 1 day)
随机推荐
函数栈帧的创建和销毁
7.TCP的十一种状态集
No logic is executed after the El form is validated successfully
Domestic all Chinese automatic test software apifox
Gee series: unit 6 building various remote sensing indexes in Google Earth engine
The reason why sizeof (ARR) / sizeof (arr[0]) is used in the function to calculate the length of the array is incorrect
Online English teaching app open source platform (customized)
Leetcode basic programming: array
Mathematical problems (number theory) trial division to judge prime numbers, decompose prime factors, and screen prime numbers
Global and Chinese market of hydrocyclone desander 2022-2028: Research Report on technology, participants, trends, market size and share
國產全中文-自動化測試軟件Apifox
Video cover image setting, put cover images into multiple videos in the simplest way
Find the subscript with and as the target from the array
Set the default style of scroll bar Google browser
Fabric. JS centered element
ubuntu20.04安装mysql8
Gee series: Unit 5 remote sensing image preprocessing [GEE grid preprocessing]
Creation and destruction of function stack frames
Mysql基础---查询(1天学会mysql基础)
Fabric. JS right click menu