侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

CentOS 7 安装 MySQL 5.6遇到的各种问题小结

linux  /  管理员 发布于 7年前   397

在一测试服务器(CentOS Linux release 7.2.1511)上安装MySQL 5.6(5.6.19 MySQL Community Server)时遇到下面错误,这个是因为CentOS 7的默认数据库已经不再是MySQL了,而是MariaDB. MySQL安装时的mysql lib库与mariadb的库、包冲突了,如下详情所示(省略了大量日志)

[root@azrlnx06 tmp]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm Preparing... ################################# [100%]file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64........................................................................................................................................................................file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64

检查是否存在mariadb的相关组件,然后删除mariadb相关组件。如下所示:

[root@azrlnx06 mysql]# more /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@azrlnx06 mysql]# rpm -qa |grep mariadbmariadb-libs-5.5.50-1.el7_2.x86_64[root@azrlnx06 mysql]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64error: Failed dependencies:libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64[root@azrlnx06 mysql]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64 --nodeps

当然此处删除mariadb-libs-5.5.50-1.el7_2.x86_64组件时遇到依赖错误,遂强制删除该组件,最好使用yum删除mariadb相关组件。然后重新安装MySQL时遇到"error: MySQL-server-advanced-5.6.20-1.rhel5.x86_64: install failed"错误,如下所示:

[root@azrlnx06 mysql]# cd /tmp[root@azrlnx06 tmp]# lshsperfdata_azrlnx06 jirasetup MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm[root@azrlnx06 tmp]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm Preparing... ################################# [100%]Updating / installing...1:MySQL-server-advanced-5.6.20-1.rh################################# [100%]error: unpacking of archive failed on file /usr/bin/innochecksum;582535c8: cpio: read failed - No such file or directoryerror: MySQL-server-advanced-5.6.20-1.rhel5.x86_64: install failed[root@azrlnx06 tmp]# clip_image001

 

对这个错误有点莫名其妙,卸载MySQL相关组件后,重新安装MySQL,发现缺少Perl相关模组。如下所示:

[root@azrlnx06 jirasetup]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm Preparing... ################################# [100%]Updating / installing...1:MySQL-server-advanced-5.6.20-1.rh################################# [100%]FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:Data::Dumper[root@azrlnx06 jirasetup]# 

使用yum安装了 perl perl-devel相关包(注意:此处安装MySQL时,没有输出安装相关Detail的信息,是因为Perl相关模组没有安装的缘故,此处还漏掉了安装perl-Data-Dumper)

[root@azrlnx06 jirasetup]# yum install -y perl perl-devel

安装完Perl相关组件后,重新安装MySQL,如下所示,安装成功,但是没有输出安装相关Detail的信息(因为没有安装perl-Data-Dumper),启动MySQL报错

root@azrlnx06 jirasetup]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm Preparing... ################################# [100%]Updating / installing...1:MySQL-server-advanced-5.6.20-1.rh################################# [100%][root@azrlnx06 jirasetup]# rpm -ivh MySQL-client-advanced-5.6.20-1.rhel5.x86_64.rpm Preparing... ################################# [100%]Updating / installing...1:MySQL-client-advanced-5.6.20-1.rh################################# [100%][root@azrlnx06 ~]# service mysql startStarting MySQL............. ERROR! The server quit without updating PID file (/var/lib/mysql/azrlnx06.pid).[root@azrlnx06 ~]#

找到MySQL的错误日志,然后检查/var/lib/mysql/azrlnx06.err错误日志,发现如下错误信息:

[root@azrlnx06 mysql]# find / -name *.err/var/lib/mysql/azrlnx06.err/var/log/azure/Microsoft.OSTCExtensions.LinuxDiagnostic/2.3.9011/mdsd.err/var/log/azure/Microsoft.OSTCExtensions.LinuxDiagnostic/2.3.9013/mdsd.err/var/log/mdsd/mdsd.err[root@azrlnx06 mysql]# more /var/lib/mysql/azrlnx06.err161111 03:28:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql2016-11-11 03:28:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2016-11-11 03:28:25 2144 [Note] Plugin 'FEDERATED' is disabled./usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist2016-11-11 03:28:25 2144 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.2016-11-11 03:28:25 2144 [Note] InnoDB: Using atomics to ref count buffer pool pages2016-11-11 03:28:25 2144 [Note] InnoDB: The InnoDB memory heap is disabled2016-11-11 03:28:25 2144 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2016-11-11 03:28:25 2144 [Note] InnoDB: Memory barrier is not used2016-11-11 03:28:25 2144 [Note] InnoDB: Compressed tables use zlib 1.2.32016-11-11 03:28:25 2144 [Note] InnoDB: Using Linux native AIO2016-11-11 03:28:25 2144 [Note] InnoDB: Using CPU crc32 instructions2016-11-11 03:28:25 2144 [Note] InnoDB: Initializing buffer pool, size = 128.0M2016-11-11 03:28:25 2144 [Note] InnoDB: Completed initialization of buffer pool2016-11-11 03:28:25 2144 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2016-11-11 03:28:25 2144 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2016-11-11 03:28:25 2144 [Note] InnoDB: Database physically writes the file full: wait...2016-11-11 03:28:26 2144 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2016-11-11 03:28:31 2144 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2016-11-11 03:28:37 2144 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02016-11-11 03:28:37 2144 [Warning] InnoDB: New log files created, LSN=457812016-11-11 03:28:37 2144 [Note] InnoDB: Doublewrite buffer not found: creating new2016-11-11 03:28:37 2144 [Note] InnoDB: Doublewrite buffer created2016-11-11 03:28:37 2144 [Note] InnoDB: 128 rollback segment(s) are active.2016-11-11 03:28:37 2144 [Warning] InnoDB: Creating foreign key constraint system tables.2016-11-11 03:28:37 2144 [Note] InnoDB: Foreign key constraint system tables created2016-11-11 03:28:37 2144 [Note] InnoDB: Creating tablespace and datafile system tables.2016-11-11 03:28:38 2144 [Note] InnoDB: Tablespace and datafile system tables created.2016-11-11 03:28:38 2144 [Note] InnoDB: Waiting for purge to start2016-11-11 03:28:38 2144 [Note] InnoDB: 5.6.20 started; log sequence number 02016-11-11 03:28:38 2144 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ef3b0cd5-a7be-11e6-98b3-000d3a8062fe.2016-11-11 03:28:38 2144 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.2016-11-11 03:28:38 2144 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.2016-11-11 03:28:38 2144 [Note] Server hostname (bind-address): '*'; port: 33062016-11-11 03:28:38 2144 [Note] IPv6 is available.2016-11-11 03:28:38 2144 [Note] - '::' resolves to '::';2016-11-11 03:28:38 2144 [Note] Server socket created on IP: '::'.2016-11-11 03:28:38 2144 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist161111 03:28:38 mysqld_safe mysqld from pid file /var/lib/mysql/azrlnx06.pid endedclip_image002

 

搜索了一些相关资料,应该是perl-Data-Dumper模组没有安装,导致安装过程中,初始化数据库失败,所以启动MySQL服务时,找不到相关系统表。具体参考官方文档MySQL-server RPM does not install perl-Data-Dumper as a dependency

Description:

MySQL-server requires perl-Data-Dumper to function. However, perl-Data-Dumper is not listed by the MySQL-server RPM as a dependency. So if a linux server does not have perl-Data-Dumper installed, the install-mysql-db will fail. And because of missing the initial database, the mysql service could not be started.

How to repeat:

On a linux server, make sure there is no perl-Data-Dumper installed. Install MySQL-server using yum. There should be error message complaining database could not be created.

Suggested fix:

Add perl-Data-Dumper as a dependency of the RPM package

解决方法:

1:安装perl-Data-Dumper模组。

[root@azrlnx06 mysql]# yum install -y perl-Data-Dumper

2:初始化数据库

[root@azrlnx06 mysql]# sudo mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/clip_image003

[root@azrlnx06 mysql]# service mysql startStarting MySQL. SUCCESS! [root@azrlnx06 mysql]# /usr//bin/mysqladmin -u root password 'Qwe!23'Warning: Using a password on the command line interface can be insecure.

当然也可以卸载MySQL,然后重新安装,就能看到安装过程输出的Detail信息输出了。

 

以上所述是小编给大家介绍的CentOS 7 安装 MySQL 5.6遇到的各种冲突问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对站的支持!


  • 上一条:
    Linux KVM的QCOW2 和 ROW的详解及区别介绍
    下一条:
    nginx centos 服务开机启动设置实例详解
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 在Linux系统中使用Iptables实现流量转发功能流程步骤(0个评论)
    • vim学习笔记-入门级需要了解的一些快捷键(0个评论)
    • 在centos7系统中实现分区并格式化挂载一块硬盘到/data目录流程步骤(0个评论)
    • 在Linux系统种查看某一个进程所占用的内存命令(0个评论)
    • Linux中grep命令中的10种高级用法浅析(0个评论)
    • 近期文章
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • PHP 8.4 Alpha 1现已发布!(0个评论)
    • Laravel 11.15版本发布 - Eloquent Builder中添加的泛型(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-11
    • 2017-07
    • 2017-10
    • 2017-11
    • 2018-01
    • 2018-02
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2021-02
    • 2021-03
    • 2021-04
    • 2021-06
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2021-12
    • 2022-01
    • 2022-03
    • 2022-04
    • 2022-08
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-06
    • 2023-07
    • 2023-10
    • 2023-12
    • 2024-01
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客