侧边栏壁纸
  • 累计撰写 6 篇文章
  • 累计创建 0 个标签
  • 累计收到 4 条评论

目 录CONTENT

文章目录

CentOS8安装mysql

ivioc
2021-08-25 / 0 评论 / 0 点赞 / 1,535 阅读 / 1,301 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2022-04-06,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

安装mysql

1.安装mysql
wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm

rpm -Uvh mysql57-community-release-el6-9.noarch.rpm

#在这里遇到执行yum install mysql-community-server查询不到
解决方式:
yum module disable mysql

yum install mysql-community-server

#在这里又遇到了新的问题

错误:
 问题: cannot install the best candidate for the job
  - nothing provides libsasl2.so.2()(64bit) needed by mysql-community-server-5.7.35-1.el6.x86_64
(尝试添加 '--skip-broken' 来跳过无法安装的软件包 或 '--nobest' 来不只使用软件包的最佳候选)

解决方式:
vi /etc/yum.repos.d/mysql-community.repo

修改: 
![QQ截图20210825113937.png](https://oss.ivioc.com/ivioc/QQ%E6%88%AA%E5%9B%BE20210825113937_1629863112112.png)

继续执行:
yum install mysql-community-server

2.启动mysql服务

systemctl start mysqld

3.设置开机自启

systemctl enable mysqld

systemctl daemon-reload

4.查询初始密码

vim /var/log/mysqld.log

![image.png](https://oss.ivioc.com/ivioc/image_1629863182029.png)

5.修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Ww_123456';

6.开启远程访问权限

use mysql;

update user set host = '%' where user= 'root';

#查看防火墙状态
systemctl status firewalld;

#添加mysql端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent

#刷新mysql防火墙
firewall-cmd --reload

7.修改配置

# 支持时间为0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# 不区分大小写
lower_case_table_names=1

8.修改报错

Host 'xxxxxxx' is blocked because of many connection errors; unblock with 'mysqlad
show global variables like '%max_connect_errors%';

set global max_connect_errors=1000;
0

评论区