展开菜单
首页 精品内容 本月促销 装机必备 Windows PDF教程 macOS软件 IOS软件 Android AI 专题
全部分类

当前位置:

首页 > 编程开发 > CentOS7安装MySQL5.6常见问题及解决方法

CentOS7安装MySQL5.6常见问题及解决方法

在一测试服务器(centoslinuxrelease7.2.1511)上安装mysql5.6(5.6.19mysqlcommunityserver)时遇到下面错误,这个是因为centos7的默认数据库已经不再是mysql了,而是mariadb.mysql安装时的mysqllib库与mariadb的库、包冲突了,如下详情所示(省略了大量日志)[root@azrlnx06tmp]#rpm-ivhmysql-server-advanced-5.6.20-1.rhel5.x86_64.rpmpreparing..

本文目录

    在一测试服务器(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_64
    file /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_64
    file /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_64
    file /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_64
    file /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_64
    file /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_64
    file /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_64
    file /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_64
    file /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 mariadb
    mariadb-libs-5.5.50-1.el7_2.x86_64
    [root@azrlnx06 mysql]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64
    error: failed dependencies:
    libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
    libmysqlclient.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]# ls
    hsperfdata_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 directory
    error: 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 start
    starting 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.err
    161111 03:28:25 mysqld_safe starting mysqld daemon with databases from /var/lib/mysql
    2016-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 exist
    2016-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 pages
    2016-11-11 03:28:25 2144 [note] innodb: the innodb memory heap is disabled
    2016-11-11 03:28:25 2144 [note] innodb: mutexes and rw_locks use gcc atomic builtins
    2016-11-11 03:28:25 2144 [note] innodb: memory barrier is not used
    2016-11-11 03:28:25 2144 [note] innodb: compressed tables use zlib 1.2.3
    2016-11-11 03:28:25 2144 [note] innodb: using linux native aio
    2016-11-11 03:28:25 2144 [note] innodb: using cpu crc32 instructions
    2016-11-11 03:28:25 2144 [note] innodb: initializing buffer pool, size = 128.0m
    2016-11-11 03:28:25 2144 [note] innodb: completed initialization of buffer pool
    2016-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 mb
    2016-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 mb
    2016-11-11 03:28:31 2144 [note] innodb: setting log file ./ib_logfile1 size to 48 mb
    2016-11-11 03:28:37 2144 [note] innodb: renaming log file ./ib_logfile101 to ./ib_logfile0
    2016-11-11 03:28:37 2144 [warning] innodb: new log files created, lsn=45781
    2016-11-11 03:28:37 2144 [note] innodb: doublewrite buffer not found: creating new
    2016-11-11 03:28:37 2144 [note] innodb: doublewrite buffer created
    2016-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 created
    2016-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 start
    2016-11-11 03:28:38 2144 [note] innodb: 5.6.20 started; log sequence number 0
    2016-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: 3306
    2016-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 exist
    161111 03:28:38 mysqld_safe mysqld from pid file /var/lib/mysql/azrlnx06.pid ended
    clip_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 start
    starting 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信息输出了。

    本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系bd@zhengruan.com
    作者最新文章
    编程开发 MySQL
    相关文章 更多
    精品专题 更多
    装机必备

    正软商城装机必备专区,精选办公、浏览器、安全防护、影音播放、压缩解压、设计创作和系统工具等电脑常用正版软件,帮助用户快速完成新电脑软件配置。

    Windows

    正软商城Windows软件专区,汇集适用于Windows电脑的办公、设计、安全防护、影音播放、开发工具和系统优化软件,提供软件介绍、系统要求、正版授权及购买下载服务。

    PDF教程

    正软商城PDF教程频道提供PDF编辑、转换、合并、拆分、压缩及格式处理方法,同时介绍常用PDF软件和工具的使用技巧。

    macOS软件

    正软商城macOS软件专区,精选适用于Mac电脑的办公、设计、影音、效率、开发和系统工具,提供软件功能介绍、macOS兼容版本、正版授权及购买下载服务。

    IOS软件

    正软商城iOS软件专区,精选适用于iPhone和iPad的办公、学习、影音、设计、效率及AI应用,提供功能介绍、适用设备、系统要求和正版获取方式等信息。

    AI

    正软商城AI软件专区,汇集AI写作、AI绘画、AI视频、AI办公、AI编程、AI翻译、智能客服和数据分析等人工智能工具,提供功能介绍、适用平台、收费方式及正版购买信息。

    Mac软件 更多
    Aperty macOS版
    Aperty macOS版

    Aperty 是 Skylum 推出的 AI 人像修图软件,支持自然肤质修饰、瑕疵处理、面部与身体调整、预设及批量同步。

    火山引擎 网页版
    火山引擎 网页版

    火山引擎是字节跳动旗下企业级云与AI服务平台。聚焦大模型核心能力,依托字节自研豆包多模态大模型,凭借火山方舟一站式平台,提供模型精调、推理部署、智能应用搭建等全链路服务,结合高性能AI算力,助力各行业快速落地大模型数字化与智能化应用。

    立刻MV 网页版
    立刻MV 网页版

    立刻MV 面向音乐人、内容创作者和品牌团队,帮助用户低成本完成歌曲 MV、歌词视频、AI 分镜、图生视频与最终合成。

    蛙蛙写作 网页版
    蛙蛙写作 网页版

    蛙蛙写作 AI 创作工具,覆盖小说、剧本、文案,一键生成文稿,打通文字转视频全流程,高效解决创作难题。

    讯飞智作 网页版
    讯飞智作 网页版

    讯飞智作是一款基于语音合成技术、虚拟人驱动技术与数字人形象声音构建能力的 AI 数字人音视频创作平台。

    超级简历WonderCV 网页版
    超级简历WonderCV 网页版

    超级简历WonderCV是面向应届生和AI小白的智能求职平台,覆盖简历、面试与职业规划。

    音述AI 网页版
    音述AI 网页版

    音述AI,是一个以“用声音述说故事”为核心的 AI 音乐创作与声音分享社区。

    AionClaw macOS版
    AionClaw macOS版

    AionClaw 是可在桌面端运行的任务型 AI 助手,通过数字专家与技能市场组合办公、创作、数据和开发能力。

    Loomy macOS版
    Loomy macOS版

    Loomy 是科大讯飞推出的桌面 AI 助手,可通过对话、任务与工作目录协助处理办公、内容创作和资料整理。

    AirBuddy 3 macOS版
    AirBuddy 3 macOS版

    AirBuddy 3 是面向 macOS 的蓝牙外设增强工具,可集中查看 AirPods、Beats 与苹果设备电量,提供快速连接、播放控制、电量提醒、桌面小组件和多台 Mac 外设接力等功能。

    AirServer macOS版
    AirServer macOS版

    AirServer macOS版可把 Mac 转换为无线投屏接收端,通过 AirPlay 或 Google Cast 接收手机、平板和电脑画面,并支持多设备同时连接、高清镜像及会话录制,适合家庭娱乐、课堂教学、会议演示和应用展示。

    AnyDesk macOS版
    AnyDesk macOS版

    AnyDesk macOS版是一款适用于远程办公、设备维护和客户支持的远程桌面工具,可连接并操作异地计算机,支持文件传输、无人值守访问、会话权限控制及跨平台协作。

    WINDOWS 更多
    讯飞绘文 网页版
    讯飞绘文 网页版

    讯飞绘文网页版是科大讯飞推出的AI图文创作与内容运营工具,覆盖热点选题、文章生成、稿件校对、智能配图、排版发布和数据复盘等环节,适合自媒体创作者及内容团队在线使用。

    Maya(Autodesk Maya) Windows版
    Maya(Autodesk Maya) Windows版

    Autodesk Maya 是面向影视、电视、动画和游戏行业的专业三维制作软件,集多边形与 NURBS 建模、角色绑定、关键帧和动作捕捉动画、Bifrost 特效模拟、材质开发及 Arnold 渲染于一体,

    Aperty Windows版
    Aperty Windows版

    Aperty 是 Skylum 推出的 AI 人像修图软件,支持自然肤质修饰、瑕疵处理、面部与身体调整、预设及批量同步。

    火山引擎 网页版
    火山引擎 网页版

    火山引擎是字节跳动旗下企业级云与AI服务平台。聚焦大模型核心能力,依托字节自研豆包多模态大模型,凭借火山方舟一站式平台,提供模型精调、推理部署、智能应用搭建等全链路服务,结合高性能AI算力,助力各行业快速落地大模型数字化与智能化应用。

    立刻MV 网页版
    立刻MV 网页版

    立刻MV 面向音乐人、内容创作者和品牌团队,帮助用户低成本完成歌曲 MV、歌词视频、AI 分镜、图生视频与最终合成。

    蛙蛙写作 网页版
    蛙蛙写作 网页版

    蛙蛙写作 AI 创作工具,覆盖小说、剧本、文案,一键生成文稿,打通文字转视频全流程,高效解决创作难题。

    讯飞智作 网页版
    讯飞智作 网页版

    讯飞智作是一款基于语音合成技术、虚拟人驱动技术与数字人形象声音构建能力的 AI 数字人音视频创作平台。

    超级简历WonderCV 网页版
    超级简历WonderCV 网页版

    超级简历WonderCV是面向应届生和AI小白的智能求职平台,覆盖简历、面试与职业规划。

    音述AI 网页版
    音述AI 网页版

    音述AI,是一个以“用声音述说故事”为核心的 AI 音乐创作与声音分享社区。

    AionClaw Windows版
    AionClaw Windows版

    AionClaw 是可在桌面端运行的任务型 AI 助手,通过数字专家与技能市场组合办公、创作、数据和开发能力。

    Loomy Windows版
    Loomy Windows版

    Loomy 是科大讯飞推出的桌面 AI 助手,可通过对话、任务与工作目录协助处理办公、内容创作和资料整理。

    AirServer Windows版
    AirServer Windows版

    AirServer Windows版可把电脑变成AirPlay、Google Cast和Miracast无线投屏接收端,适合会议演示、课堂教学及家庭大屏分享。发送设备通常无需另装客户端,并可同时接收和智能排列多个镜像会话。