在一测试服务器(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.rpmPreparing...                          ################################# [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-releaseCentOS 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.rpmPreparing...                          ################################# [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]#

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

[root@azrlnx06 jirasetup]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpmPreparing...                          ################################# [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.rpmPreparing...                          ################################# [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.rpmPreparing...                          ################################# [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 ended

搜索了一些相关资料,应该是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/

[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 安装mysql5.6.20_CentOS 7 安装MySQL 5.6遇到的疑难杂症小结相关推荐

  1. Centos6.8下安装Mysql5.6.14,连接mysql及增删改查,通过Mysql-Front远程连接(开启端口、允许远程连接)

    Centos6.8下安装Mysql5.6.14,连接mysql及增删改查,并能通过Mysql-Front远程连接(开启端口.允许远程连接) 概述: 通过源代码安装高版本的5.6.14. 正文: 一:卸 ...

  2. 已经安装mysql xampp_windows 7 本机已安装mysql5的情况上 安装XAMPP

    windows 7 本机已安装mysql5的情况下 安装XAMPP 我的环境是windows 7 本机已安装mysql5,主要用来做java ee开发. 现在要跑php,就安装XAMPP了,正常安装后 ...

  3. Windows10安装mysql5.7.17免安装版

    Windows10安装mysql5.7.17免安装版 电脑已经安装过mysql的 卸载电脑上的mysql方法: 1.我的电脑–>右键–>属性–>高级系统设置–>环境变量–> ...

  4. centos 6.5安装mysql5.7,centos6.5安装mysql5.7

    dev.mysql.com/downloads/file/?id=473559 检查并删除以前的mysql  请看上篇   CentOS6.5 下MySQL傻瓜式安装 2.把压缩包放到  /usr/l ...

  5. centos 编译mysql5.6_centos下编译安装MySQL5.6

    ,虚拟机centos6.5mini 网络适配器"桥接模式" 继续上一次的Apache编译后,编译安装MySQL5.6 MySQL5.6和以前的版本不同之处在于用cmake就行编译, ...

  6. centos编译mysql5.6_centos7上编译安装mysql5.6

    注意,在做实验室统一关闭防火墙做的,在生产环境需要做防火墙规则的,大家要注意,做的时候尽量都是模仿生产环境的,比如服务一般都在/data/soft下面,尽量避免在/usr/local/下面. 安装编译 ...

  7. rpm安装mysql5.6_利用rpm安装mysql 5.6版本详解

    前言 其实之前使用yum安装MySQL确实很方便,但是默认安装的myql5.0版本的,不支持utf8mb4(utf8mb4扩展到一个字符最多能有4节,所以能支持更多的字符集,比如支持emoji表情)编 ...

  8. MySQL安装 MySQL5.7.10免安装版配置,mysql5.7.10免安装版

    MySQL5.7.10免安装版配置,mysql5.7.10免安装版  最新版的 Mysql 不提供图形界面的安装了, 下载下来是一个压缩包的形式, 那么我们如何来使用它呢, 让它为我们工作呢? 环境: ...

  9. centos下yum安装mysql5.7_CentOS下yum安装mysql5.7

    文章目录 [隐藏] 1.安装yum库 2.安装mysql 3.启动mysql 4.获取初次安装时root的密码 5.修改root密码 6.允许root远程登录 1.安装yum库 [root@dream ...

最新文章

  1. 52 个深度学习目标检测模型汇总,论文、源码一应俱全!(附链接)
  2. for 循环里调用ajax,for循环中ajax异步问题如何解决?
  3. OpenGL ktxview (KTX查看器)的实例
  4. valgrind工具使用详解
  5. LeetCode 669. 修剪二叉搜索树
  6. Redis:复制,第3部分——redis-py和Python中的Redi哨兵一起使用
  7. VMware复制Centos6虚拟机要改的地方
  8. lambda 函数或者匿名函数(C++11)
  9. 网页编码_Python获取网页编码(apparent_encoding)
  10. 2021年研究生数学建模竞赛优秀论文汇总
  11. WPS安装后显示系统字体找不到
  12. 魔百和CM311-1a YST免拆机卡刷精简固件
  13. 有趣!10个你不得不知的Linux终端游戏
  14. 2022年股权转让中这8个问题,你必须重视起来
  15. 高斯消元法(C++实现)
  16. css根据某个角旋转,设置旋转中心点
  17. 什么是2.5D 点云?
  18. 香港理工大学智能计算实验室招收进化计算/机器学习/类脑计算方向全奖博士生/研究助理/博士后...
  19. springboot启动错误: 找不到或无法加载主类
  20. winds_mysql8.0安装方法

热门文章

  1. springboot整合dubbo_springboot整合dubbo设置全局唯一ID进行日志追踪
  2. python tkinter库、添加gui界面_使用Python中tkinter库简单gui界面制作及打包成exe的操作方法(二)...
  3. 设计模式入门:建造者模式
  4. 云计算正在告别DIY时代 阿里云专有云挑起企业级市场大梁
  5. Python之旅.第九章.并发编程..
  6. Webpack 最佳实践总结(一)
  7. 《Python数据科学指南》——1.17 使用映射函数
  8. Linux系统下文件与目录权限管理
  9. 29个你必须知道的Linux命令
  10. 微软MSIT部门招Sr SDE for FSS team