• ADADADADAD

    CentOS7安装MySQL5.6遇到的问题怎么解决[ mysql数据库 ]

    mysql数据库 时间:2024-11-25 13:35:23

    作者:文/会员上传

    简介:

    在一测试服务器(centos linux release 7.2.1511)上安装mysql 5.6(5.6.19 mysql community server)时遇到下面错误,这个是因为centos 7的默认数据库已经不再是mysql了,而是mariadb.

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

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

    [root@azrlnx06tmp]#rpm-ivhmysql-server-advanced-5.6.20-1.rhel5.x86_64.rpmpreparing...#################################[100%]file/usr/share/mysql/czech/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/danish/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/dutch/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/english/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/estonian/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/french/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/german/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/greek/errmsg.sysfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64........................................................................................................................................................................file/usr/share/mysql/charsets/macroman.xmlfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64file/usr/share/mysql/charsets/swe7.xmlfrominstallofmysql-server-advanced-5.6.20-1.rhel5.x86_64conflictswithfilefrompackagemariadb-libs-1:5.5.50-1.el7_2.x86_64

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

    [root@azrlnx06mysql]#more/etc/redhat-releasecentoslinuxrelease7.2.1511(core)[root@azrlnx06mysql]#rpm-qa|grepmariadbmariadb-libs-5.5.50-1.el7_2.x86_64[root@azrlnx06mysql]#rpm-emariadb-libs-5.5.50-1.el7_2.x86_64error:faileddependencies:libmysqlclient.so.18()(64bit)isneededby(installed)postfix-2:2.10.1-6.el7.x86_64libmysqlclient.so.18(libmysqlclient_18)(64bit)isneededby(installed)postfix-2:2.10.1-6.el7.x86_64[root@azrlnx06mysql]#rpm-emariadb-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@azrlnx06mysql]#cd/tmp[root@azrlnx06tmp]#lshsperfdata_azrlnx06jirasetupmysql-server-advanced-5.6.20-1.rhel5.x86_64.rpm[root@azrlnx06tmp]#rpm-ivhmysql-server-advanced-5.6.20-1.rhel5.x86_64.rpmpreparing...#################################[100%]updating/installing...1:mysql-server-advanced-5.6.20-1.rh#################################[100%]error:unpackingofarchivefailedonfile/usr/bin/innochecksum;582535c8:cpio:readfailed-nosuchfileordirectoryerror:mysql-server-advanced-5.6.20-1.rhel5.x86_64:installfailed[root@azrlnx06tmp]#clip_image001

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

    [root@azrlnx06jirasetup]#rpm-ivhmysql-server-advanced-5.6.20-1.rhel5.x86_64.rpmpreparing...#################################[100%]updating/installing...1:mysql-server-advanced-5.6.20-1.rh#################################[100%]fatalerror:pleaseinstallthefollowingperlmodulesbeforeexecuting/usr/bin/mysql_install_db:data::dumper[root@azrlnx06jirasetup]#

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

    [root@azrlnx06jirasetup]#yuminstall-yperlperl-devel

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

    root@azrlnx06jirasetup]#rpm-ivhmysql-server-advanced-5.6.20-1.rhel5.x86_64.rpmpreparing...#################################[100%]updating/installing...1:mysql-server-advanced-5.6.20-1.rh#################################[100%][root@azrlnx06jirasetup]#rpm-ivhmysql-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~]#servicemysqlstartstartingmysql.............error!theserverquitwithoutupdatingpidfile(/var/lib/mysql/azrlnx06.pid).[root@azrlnx06~]#

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

    [root@azrlnx06mysql]#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@azrlnx06mysql]#more/var/lib/mysql/azrlnx06.err16111103:28:25mysqld_safestartingmysqlddaemonwithdatabasesfrom/var/lib/mysql2016-11-1103:28:250[warning]timestampwithimplicitdefaultvalueisdeprecated.pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2016-11-1103:28:252144[note]plugin'federated'isdisabled./usr/sbin/mysqld:table'mysql.plugin'doesn'texist2016-11-1103:28:252144[error]can'topenthemysql.plugintable.pleaserunmysql_upgradetocreateit.2016-11-1103:28:252144[note]innodb:usingatomicstorefcountbufferpoolpages2016-11-1103:28:252144[note]innodb:theinnodbmemoryheapisdisabled2016-11-1103:28:252144[note]innodb:mutexesandrw_locksusegccatomicbuiltins2016-11-1103:28:252144[note]innodb:memorybarrierisnotused2016-11-1103:28:252144[note]innodb:compressedtablesusezlib1.2.32016-11-1103:28:252144[note]innodb:usinglinuxnativeaio2016-11-1103:28:252144[note]innodb:usingcpucrc32instructions2016-11-1103:28:252144[note]innodb:initializingbufferpool,size=128.0m2016-11-1103:28:252144[note]innodb:completedinitializationofbufferpool2016-11-1103:28:252144[note]innodb:thefirstspecifieddatafile./ibdata1didnotexist:anewdatabasetobecreated!2016-11-1103:28:252144[note]innodb:settingfile./ibdata1sizeto12mb2016-11-1103:28:252144[note]innodb:databasephysicallywritesthefilefull:wait...2016-11-1103:28:262144[note]innodb:settinglogfile./ib_logfile101sizeto48mb2016-11-1103:28:312144[note]innodb:settinglogfile./ib_logfile1sizeto48mb2016-11-1103:28:372144[note]innodb:renaminglogfile./ib_logfile101to./ib_logfile02016-11-1103:28:372144[warning]innodb:newlogfilescreated,lsn=457812016-11-1103:28:372144[note]innodb:doublewritebuffernotfound:creatingnew2016-11-1103:28:372144[note]innodb:doublewritebuffercreated2016-11-1103:28:372144[note]innodb:128rollbacksegment(s)areactive.2016-11-1103:28:372144[warning]innodb:creatingforeignkeyconstraintsystemtables.2016-11-1103:28:372144[note]innodb:foreignkeyconstraintsystemtablescreated2016-11-1103:28:372144[note]innodb:creatingtablespaceanddatafilesystemtables.2016-11-1103:28:382144[note]innodb:tablespaceanddatafilesystemtablescreated.2016-11-1103:28:382144[note]innodb:waitingforpurgetostart2016-11-1103:28:382144[note]innodb:5.6.20started;logsequencenumber02016-11-1103:28:382144[warning]noexistinguuidhasbeenfound,soweassumethatthisisthefirsttimethatthisserverhasbeenstarted.generatinganewuuid:ef3b0cd5-a7be-11e6-98b3-000d3a8062fe.2016-11-1103:28:382144[note]rsaprivatekeyfilenotfound:/var/lib/mysql//private_key.pem.someauthenticationpluginswillnotwork.2016-11-1103:28:382144[note]rsapublickeyfilenotfound:/var/lib/mysql//public_key.pem.someauthenticationpluginswillnotwork.2016-11-1103:28:382144[note]serverhostname(bind-address):'*';port:33062016-11-1103:28:382144[note]ipv6isavailable.2016-11-1103:28:382144[note]-'::'resolvesto'::';2016-11-1103:28:382144[note]serversocketcreatedonip:'::'.2016-11-1103:28:382144[error]fatalerror:can'topenandlockprivilegetables:table'mysql.user'doesn'texist16111103:28:38mysqld_safemysqldfrompidfile/var/lib/mysql/azrlnx06.pidendedclip_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@azrlnx06mysql]#yuminstall-yperl-data-dumper

    2:初始化数据库

    [root@azrlnx06mysql]#sudomysql_install_db--user=mysql--basedir=/usr/--ldata=/var/lib/mysql/clip_image003
    [root@azrlnx06mysql]#servicemysqlstartstartingmysql.success![root@azrlnx06mysql]#/usr//bin/mysqladmin-urootpassword'qwe!23'warning:usingapasswordonthecommandlineinterfacecanbeinsecure.

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

    CentOS7安装MySQL5.6遇到的问题怎么解决.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: mysqlcentos7