在CentOS7.3中安装了MySQL8.0.21之后,就开启了一段漫长的爬坑历程,简要回顾如下:

一、从Win10中用Navicat连接安装好的MySQL服务器

出现如下异常:1045 - Access denied for user ‘root’@‘192.168.101.151’(using password: YES)

二、尝试解决遇到的防火墙问题

在网上查阅了多篇博客,结论可能是3306端口没有加入到防火墙的允许列表。
接着,开始研究了CentOS7中的防火墙,发现RHEL6之前版本用的防火墙管理工具都是iptables,而自RHEL7起,Firewalld动态防火墙管理器服务(Dynamic Firewall Manager of Linux systems)就成了默认的防火墙管理工具。
通过yum -y install iptables-services命令安装iptables:

然后启动iptables,出现异常,记录如下:

[root@localhost~]# systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
[root@localhost~]# systemctl start iptables
Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details.
[root@localhost~]# systemctl status iptables.service
● iptables.service - IPv4 firewall with iptablesLoaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)Active: failed (Result: exit-code) since 一 2020-08-31 16:45:01 CST; 2min 53s agoProcess: 16808 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=1/FAILURE)Main PID: 16808 (code=exited, status=1/FAILURE)8月 31 16:45:01 localhost.localdomain systemd[1]: Starting IPv4 firewall with iptables...
8月 31 16:45:01 localhost.localdomain iptables.init[16808]: iptables: Applying firewall rules: iptables-restore: line 1 failed
8月 31 16:45:01 localhost.localdomain iptables.init[16808]: [失败]
8月 31 16:45:01 localhost.localdomain systemd[1]: iptables.service: main process exited, code=exited, status=1/FAILURE
8月 31 16:45:01 localhost.localdomain systemd[1]: Failed to start IPv4 firewall with iptables.
8月 31 16:45:01 localhost.localdomain systemd[1]: Unit iptables.service entered failed state.
8月 31 16:45:01 localhost.localdomain systemd[1]: iptables.service failed.

尝试解决上述异常,未果,转而尝试启用firewalld:
systemctl disable iptables;systemctl stop iptables #禁止iptables开机启动;停止iptables
据说iptables和firewalld不能同时运行。
使用systemctl start firewalld或service firewalld start启动firewalld,记录如下:

[root@localhost~]# systemctl start firewalld
Job for firewalld.service failed because the control process exited with error code. See "systemctl status firewalld.service" and "journalctl -xe" for details.
[root@localhost~]# vim /usr/sbin/firewalld
##将 #!/usr/bin/python -Es修改为#!/usr/bin/python2 -Es或#!/usr/bin/python2.7 -Es
[root@localhost~]# service firewalld start
Redirecting to /bin/systemctl start  firewalld.service
[root@localhost~]# systemctl start firewalld

查看firewalld状态:
systemctl status firewalld;firewall-cmd --state
或者:systemctl status firewalld.service;firewall-cmd --state

[root@localhost~]# systemctl status firewalld -l;firewall-cmd --state
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: inactive (dead) since 一 2020-08-31 17:06:44 CST; 4min 25s agoDocs: man:firewalld(1)Process: 17225 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)Main PID: 17225 (code=exited, status=0/SUCCESS)8月 31 17:06:44 localhost.localdomain firewalld[17225]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
8月 31 17:06:44 localhost.localdomain firewalld[17225]: WARNING: ipset not usable, disabling ipset usage in firewall.
8月 31 17:06:44 localhost.localdomain firewalld[17225]: WARNING: Failed to load nf_conntrack module: modprobe: ERROR: could not insert 'nf_conntrack': Unknown symbol in module, or unknown parameter (see dmesg)modprobe: ERROR: Error running install command for nf_conntrackmodprobe: ERROR: could not insert 'nf_conntrack': Operation not permitted
8月 31 17:06:44 localhost.localdomain firewalld[17225]: ERROR: Failed to read file "/proc/sys/net/netfilter/nf_conntrack_helper": [Errno 2] 没有那个文件或目录: '/proc/sys/net/netfilter/nf_conntrack_helper'
8月 31 17:06:44 localhost.localdomain firewalld[17225]: WARNING: Failed to get and parse nf_conntrack_helper setting
8月 31 17:06:44 localhost.localdomain firewalld[17225]: WARNING: iptables not usable, disabling IPv4 firewall.
8月 31 17:06:44 localhost.localdomain firewalld[17225]: WARNING: ip6tables not usable, disabling IPv6 firewall.
8月 31 17:06:44 localhost.localdomain firewalld[17225]: WARNING: ebtables not usable, disabling ethernet bridge firewall.
8月 31 17:06:44 localhost.localdomain firewalld[17225]: FATAL ERROR: No IPv4 and IPv6 firewall.
8月 31 17:06:44 localhost.localdomain firewalld[17225]: ERROR: Raising SystemExit in run_server
not running

接下来,又尝试解决ERROR: Failed to read file “/proc/sys/net/netfilter/nf_conntrack_helper”: [Errno 2] 没有那个文件或目录: '/proc/sys/net/netfilter/nf_conntrack_helper’异常,得知/proc/sys/net/netfilter目录下都是虚拟文件,暂时未找到该异常的解决办法。

三、幡然醒悟,回归正途

绕了一大圈,结果还是一头雾水,静心梳理一下此前的思路,猛然发现我解决问题的方向已经跑偏了,本来要解决客户端连接MySQL服务器时出现的“1045 - Access denied for user”异常,结果一度跑偏到解决防火墙的“FATAL ERROR: No IPv4 and IPv6 firewall.”异常了。于是,我又果断回头,开始搜寻“1045 - Access denied for user”异常相关的解决办法。虽然后来找到的几种方案都不太理想,但从https://www.cnblogs.com/zhoading/p/11562514.html博客中得到重大启发,即:客户端连接MySQL服务器时,需要服务器端事先对客户端进行授权。
总算有了眉目,于是立即开始新的尝试:

grant all privileges on *.* to 'root'@'192.168.101.151' identified by 'tt111222';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'tt111222'' at line 1

上述命令修改为:

mysql> grant all privileges on *.* to 'root'@'192.168.101.151' IDENTIFIED WITH mysql_native_password BY 'tt111222';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH mysql_native_password BY 'tt111222'' at line 1

上述命令再次修改为:

mysql> grant all privileges on *.* to 'root'@'192.168.101.151' IDENTIFIED WITH 'tt111222';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH 'tt111222'' at line 1mysql> grant all privileges on *.* to 'root'@'%' with grant option;
mysql> grant all privileges on *.* to 'root'@'localhost' with grant option;
Query OK, 0 rows affected (0.22 sec)mysql> grant all privileges on *.* to 'root'@'192.168.101.151' with grant option;
ERROR 1410 (42000): You are not allowed to create a user with GRANT

多次尝试多次受挫后,心生疑问:客户端连接MySQL服务器时难道不可使用root账户,而是需要创建其它独立用户?之后,尝试创建新的账户,并进行授权,结果,居然真的成功了!!

mysql> use mysql;create user edmond identified by 'tt111222';
Database changed
Query OK, 0 rows affected (0.03 sec)
mysql> GRANT EXECUTE,INSERT,SELECT,UPDATE,DELETE ON *.* TO 'edmond'@'%';
Query OK, 0 rows affected (0.00 sec)mysql> FLUSH   PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

看到“连接成功”四个字,简直是百感交集啊!
又可以继续前进了,又可以在漫漫征途中不断地跳入、爬出大大小小的豪华新坑了!

转自:https://blog.csdn.net/shinyolive/article/details/108294935

centos7 安装mysql8_CentOS7中安装MySQL8.0.21爬坑记录相关推荐

  1. mysql安装教程8.0.21安装,Windows系统下MySQL8.0.21安装教程(图文详解)

    安装建议:尽量不要用.exe进行安装,用压缩包安装,对日后的卸载/版本升级更为方便 下载地址:https://dev.mysql.com/downloads/mysql/ 1.点击上面的下载地址得到z ...

  2. Centos7 安装mysql8.0.21 Compressed TAR Archive版

    Centos7 安装mysql8.0.21 Compressed TAR Archive版 一.官网下载安装包https://downloads.mysql.com/archives/communit ...

  3. 凝思mysql服务器搭建_凝思8安装mysql8.0.21安装记录 及问题处理

    凝思8安装mysql8.0.21安装记录 及问题处理 https://www.cndba.cn/cndba/q8624806/article/4349https://www.cndba.cn/cndb ...

  4. mysql8.0.21.0 安装

    1.下载 在Win10环境下安装MySql8.0,下载地址:https://downloads.mysql.com/archives/community/ (官网下载会有些慢) 第一个是稳定版的 第二 ...

  5. mysql8.0.21官网安装步骤_MySQL8.0.21安装步骤及出现问题解决方案

    这篇文章主要介绍了MySQL8.0.21安装步骤及出现问题解决方案,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下 官网下载 先去官网下载M ...

  6. 华为云CENTOS下安装MySQL及重置mysql8.0密码

    华为云貌似无法重置密码,一直报错权限不足,老老实实的重装,查询默认密码登录. Linux下安装MySQL及重置mysql8.0密码 2018年12月30日 16:48:57 PHP,Python 阅读 ...

  7. labview linux 内核 不匹配,Linux CentOS7(或Ubuntu)中安装NI-VISA后一打开范例Simple Serial.vi就闪退,LabVIEW就崩溃。...

    Linux CentOS7(或Ubuntu)中安装NI-VISA后一打开范例Simple Serial.vi就闪退,LabVIEW就崩溃. 我安装了LabVIEW pro 2017 for Linux ...

  8. centos7安装mysql日志空白_centos7安装Mysql爬坑记录 - G

    centos7安装Mysql爬坑记录 查看是否已安装 使用下列命令查看是否已经安装过mysql/mariadb/PostgreSQL 如果未安装,不返回任何结果(ECS的centos镜像默认未安装任何 ...

  9. 使用工具连接linux中的mysql8.0

    使用工具连接linux中的mysql8.0 在搭建完LNMP环境后用Navicate/mysql Workbench连接出错 遇到这个问题首先到mysql所在的服务器上用连接进行处理 1.连接服务器: ...

最新文章

  1. 人脸验证 DeepID 算法实践
  2. 计算机端口封闭,如何查询局域网内被封的电脑端口?
  3. Ubuntu 扩展内存或断电之后卡在 /dev/sda1 clean 和 /dev/sda1 recovering journal
  4. iOS 两种易混淆的存储路径
  5. Python老师遇到的那些无语的问题
  6. (转)WinForm中的各种表格控件
  7. I/O多路复用之select
  8. java通过密钥得到谷歌验证码
  9. Google Arcore
  10. redis过期策略有哪些?内存淘汰机制有哪些?
  11. 【流媒体开发】【数据与封装格式】20、AAC码流格式与解析
  12. 开源正弦波20kHz信号发生器 V2
  13. 计算机配件价格报告,2021年电脑配件行业趋势_2021年电脑配件行业趋势报告_中国报告大厅...
  14. beanmapper java_java – 在Spring中配置ObjectMapper
  15. 百数电商进销存管理系统:破除传统的单一管理模式
  16. Linux 下各文件夹的结构说明及用途介绍,看完这篇就秒入门了
  17. FIIL CC PRO和南卡A2降噪蓝牙耳机哪个降噪效果好?降噪效果好的蓝牙耳机推荐
  18. 高中学习,什么样的应试方法是好的?
  19. CVPR2019领域自适应/语义分割:Adapting Structural Information across Domains for Boosting Sema适应结构信息跨领域促进语义分割
  20. Out-projected type ... prohibits the use of 'public abstract fun success(e: E): Unit defined

热门文章

  1. k8s的应用打包工具Helm
  2. 【进阶】【转】项目经理常用工具
  3. angularjs1.x版本,父子组件之间的双向绑定
  4. top10开源docker开发工具
  5. ps -eo 用户自定义格式显示
  6. hibernate、mysql、中文字符问题
  7. 将视图状态存入数据库(3)
  8. python学习笔记——Day 3
  9. JQuery判断元素是否存在
  10. 环形数组求最大子数组之和