CentOS 7 安装MySQL 5.6遇到的疑难杂症小结

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

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

CentOS 7 安装MySQL 5.6遇到的疑难杂症小结

对这个错误有点莫名其妙,卸载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

CentOS 7 安装MySQL 5.6遇到的疑难杂症小结

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

CentOS 7 安装MySQL 5.6遇到的疑难杂症小结

[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信息输出了。

CentOS 7 安装MySQL 5.6遇到的疑难杂症小结

 
标签: MySQL Centos
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

  • mysql_pconnect的水挺深,apache下的数据库长连
      php的mysql持久化连接,美好的目标,却拥有糟糕的口碑,往往令人敬而远之。这到底是为啥么。近距离观察后发现,这家伙也不容易啊,要看apache的脸色,还得听mysql指挥。  对于做为apache模块运行的php来说,要实现mysql持久化连接,首先得取决于apache这个
    02-10
  • linux下mysql开启远程访问权限及防火墙开放3306端口
    linux下mysql开启远程访问权限及防火墙开放3306
    开启mysql的远程访问权限默认mysql的用户是没有远程访问的权限的,因此当程序跟数据库不在同一台服务器上时,我们需要开启mysql的远程访问权限。主流的有两种方法,改表法和授权法。相对而言,改表法比较容易一点,个人也是比较倾向于使用这种方法,因此,这
    02-10
  • php+apache+mysql
    apache2.4.7+php5.4[http://www.myhack58.com/Article/sort099/sort0100/2012/35578.htm] apachehttpd.conf:DocumentRoot:网站根目录,默认/htdocsDirectoryIndex:默认显示的文件名.默认index.html,可以有多个值.如index.html index.jsp.用空格分开Listen:端
    02-10
  • Windows下搭建apache+mysql+php开发环境
    Windows下搭建apache+mysql+php开发环境
      最近因在windows环境下搭建php开发环境遇到了各式各样的问题,故在此加以归纳总结。目的有二,一是为了避免以后再次遇到类似的问题,二是为需要的同学提供启示和借鉴。  一:下载需要的软件apache   httpd-2.2.22-win32-x86-no_ssl.msimysql     mys
    02-10
  • PHP从零开始:Apache+PHP+MySQL安装配置
    初学一个东西,最怕的恐怕就是环境配置了。我就经常碰到这样的事而浪费很多时间。  今天在网上搜索到一个图文并茂的Apache+PHP+MySQL教程,按着一步一步安装和配置下来,很快就搞定了!这里贴一下教程的地址,希望其他初学者也可以很快搞定~http://tech.163
    02-10
  • Linux测试环境搭建apache+mysql+php
    LinuxRed Hat Enterprise Linux Server release 5.4 (Tikanga)Kernel \r on an \mApache +Mysql+php搭建准备:Apache postgresql-libs-8.1.11-1.el5_1.1.i386.rpmapr-1.2.7-11.el5_3.1.i386.rpmapr-util-1.2.7-7.el5_3.2.i386.rpmhttpd-2.2.3-31.el5.i386.rpm
    02-10
  • windows支持apache、mysql、php集成环境推荐wam
    对英文不感冒的同学很容易下载到更新包,而且官方的下载速度很慢,此文件为官方原版下载,现在分享给大家。链接:https://pan.baidu.com/s/1LYyJi6FddvkQQNrLp4L6Ww 提取码:edsaMD5: 4C32136656EB25E2951E1539D264339ESHA1: 15EAC178B27EE5298883DC3BA351B81
    02-10
  • 如何搭建lamp(CentOS7+Apache+MySQL+PHP)环境
    如何搭建lamp(CentOS7+Apache+MySQL+PHP)环境在网上搜资料,自己在本地虚拟机上尝试搭建,弄了整整一天一夜,终于弄好了.网上的资料,虽然很多,但大多都是重复的,拿去试了之后,又很多都不能得到正确的结果.最终找到了适合我的linux环境的搭建方式;在这里贴出来:这
    02-10
  • CentOS 6下搭建Apache+MySQL+PHP+SSL
    网上的一些文章都已经比较老了,现在版本高了之后,其实配置是很省力的(不考虑什么负载的话)分享全过程,出了文中提到的安装epel rpmfushion 源指令不同外,其他的过程也适用与Centos 51.安装CentOS 6 ,可以选择最小安装,也可以安装桌面2.升级系统yum upda
    02-10
  • lnamp完整版[linux+apache2.4+php5.6.6+mysql5.
    Lnamp环境安装实录将采用的开源软件:Apache [WEB动态脚本服务器,做nginx的反向代理8080端口]Tengine [WEB静态文件服务器80端口]MySQL PHP 1.Apache安装A.apr安装wget -c http://mirror.bjtu.edu.cn/apache/apr/apr-1.5.1.tar.gztar -zxvf apr-1..5.tar.gzcd
    02-10
点击排行