安装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
修改:

继续执行:
yum install mysql-community-server
2.启动mysql服务
systemctl start mysqld
3.设置开机自启
systemctl enable mysqld
systemctl daemon-reload
4.查询初始密码
vim /var/log/mysqld.log

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;
评论区