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

在一测试服务器(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信息输出了。

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

(0)

相关推荐

  • CentOS7.2虚拟机上安装MySQL 5.6.32的教程

    1.MySQL 5.6.32 64位安装包下载 在官网http://dev.mysql.com/downloads/mysql/5.6.html#中使用迅雷下载MySQL 5.6.32 64位安装包下载: http://pan.baidu.com/s/1pLCiAmf 2.把下载文件通过SecureFX传递到/usr/local/src/目录中(虚拟主机CentOS7.2的IP为:192.168.1.11) 3.解压文件. cd /usr/local/src/ [root@localhost s

  • CentOS 7 x64下Apache+MySQL(Mariadb)+PHP56的安装教程详解

    每次搭建新服务器,都要来来回回把这些包再装一下,来来回回搞了不下20遍了吧,原来都是凭经验,配置过程中重复入坑是难免的,故写此文做个备忘.虽然有像xampp这样的集成包,但是在生产环境的Linux发行版上,还是通过包管理工具安装会放心.这次新买的服务器是CentOS 7(7.2)系统,相关配置也都以此版本为主,为方便操作,直接使用root用户配置. CentOS 7的源比较旧,自带的PHP是PHP 5.4,我们想要的是PHP 5.6,这就需要执行以下命令添加额外的remi源. rpm -ivh

  • Centos7下使用yum安装mysql数据库的详细教程(增强版)

    在之前给大家分享过这篇文章:CentOS 7.0下使用yum安装mysql的方法详解,小编觉得不够详细,今天给大家通过本文给大家做个补充,感兴趣的朋友可以参考下. 1. 下载mysql的repo源 $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2. 安装mysql-community-release-el7-5.noarch.rpm包 $ sudo rpm -ivh mysql-community-re

  • centOS7安装MySQL数据库

    1.先检测系统是否自带原有版本mysql安装包,如果有要先卸载删除,不然不能成功安装和启动: # rpm -qa|grep mysql      查看有哪些安装包,如果直接跳过,说明没有安装包,记忆可以直接进入第2.3 # yum remove mysql mysql-server mysql-libs compat-mysql51    注意这个代码,卸载不干净 # rm -rf /var/lib/mysql # rm /etc/my.cnf # rpm -qa|grep mysql     

  • CentOS 7.2 Yum编译安装MySQL 5.6

    本文实例为大家分享CentOS 7.2 Yum安装mysql5.6的方法,供大家参考,具体内容如下 配置CentOS SCLo源 [3] 添加 CentOS SCLo Software collections Repository. [root@linuxprobe~]# yum -y install centos-release-scl-rh centos-release-scl # set [priority=10] [root@linuxprobe~]# sed -i -e "s/\]$/

  • centos7 用rpm安装mysql详解

    最近做一个项目,需要用centos做数据服务器,用mysql数据库,就需要安装mysql数据库,之前没接触过centos,因此什么也不懂,就从网上也查了很多资料,都觉得不是最好的方法.最后结合mysql官方资料和网友的资料,最后用rpm方式安装,并总结给其他人以参考. 首先打开mysql管网,找到"yum repository"打开页面或者直接打开如下链接 http://dev.mysql.com/downloads/repo/yum/ ,找到自己需要的,点击download,下载rp

  • centos 7系统下编译安装 mysql5.7教程

    一.安装约定 mysql安装路径: /usr/local/mysql mysql数据库路径: /data/mysql my配置文件路径: /usr/local/mysql/my.cnf 二.卸载mariadb # rpm -qa | grep mariadb # rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64 包名是上一条查询得知 三.创建用户组.用户 添加mysql组 groupadd mysql 添加用户 useradd -g mysql

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

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

  • 在centOS 7安装mysql 5.7的详细教程

    参考官方文档:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/ 首先创建一个repo文件 vim /etc/yum.repos.d/mysql-community.repo 然后根据官方文档写入: 比如在centOS 7安装mysql 5.7 [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-

  • centos上安装mysql并设置远程访问的操作方法

    1.下载mysql的repo源 $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2.安装mysql-community-release-el7-5.noarch.rpm包 $ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm 安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.

  • CentOS 8 安装 MySql并设置允许远程连接的方法

    下载,安装先检查系统中是否有mysql ,MariaDB,如有,先卸载 rpm -qa | grep mysql rpm -qa | grep mariadb 如图,我的系统中存在mariaDB数据, 执行卸载如有mysql同理卸载方法相同 remove mariadb-libs-5.5.52-1.el7.x86_64 安装依赖环境 ,我们直接使用yum安装,依次执行 yum install -y perl.x86_64 yum install -y libaio.x86_64 yum inst

  • CentOS 7安装MySQL 8.0.26的过程

    1.首先,根据自己的机子到MySQL官网下载对应的数据库https://dev.mysql.com/downloads/mysql/ 2.利用xftp上传压缩包到虚拟机或者服务器的某个文件夹中,最后把MySQL压缩包解压到自定义目录,如果你在Linux下载此步骤跳过(方法不限). 3.卸载mariadb数据库,先查看mariadb的安装包,然后卸载,最后可再次查看确认,命令如下: rpm -qa | grep mariadb rpm -e mariadb-libs-5.5.68-1.el7.x8

  • centos编译安装mysql 5.6及安装多个mysql实例详解

    --1.为mysql新建组和用户 # useradd -M -s /sbin/nologin mysql --2.安装需要的库,编译器 # yum install ncurses-devel openssl-devel cmake -y --3.解压 # tar zxvf mysql-5.6.35.tar.gz # cd mysql-5.6.35 --4.编译安装 # cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADI

  • CentOS 7安装Mysql并设置开机自启动的方法

    CentOS 7不带Mysql数据库了,默认的数据库是MariaDB(Mysql的一个分支). 可以按照以下步骤手动安装Mysql数据库. 1. 下载rpm安装文件 wget http://repo.mysql.com/mysql-community-release-el7.rpm 2. 执行rpm安装 rpm -ivh mysql-community-release-el7.rpm 依赖解析完成后,出现下列选项: Dependencies Resolved ==================

  • CentOS 7安装MySQL的详细步骤

    在 CentOS7 中我们在安装 MySQL 的话会默认安装的是 MariaDB.它是一个在 MySQL 被收购之后,作者推出的应一个开源版本.但是,我们可能还是会想安装更纯正的 MySQL​ 下载并安装MySQL官方的 Yum Repository 在 MySQl 的官网上我们可以 Yum Repository 的下载链接.​ wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm​ 使用上

  • Centos 7 安装 OpenJDK 11 两种方式及问题小结

    目录 一.下载 二.卸载 三.安装 3.1 第一种方式:yum安装(适用于在线) 3.1.1 yum安装 3.1.2 查找JAVA安装目录 3.1.3 配置环境变量 3.2 第二种方式:tar解压安装(适用于离线) 3.2.1 切换到root用户,在/usr下创建java文件夹 3.2.2 上传下载好的OpenJDK文件 3.2.3 tar解压文件 3.2.4 配置环境变量 四.问题汇总 一.下载 OpenJDK: http://jdk.java.net/java-se-ri/11 清华镜像:h

  • centos下安装mysql服务器的方法

    项目需要就在现有的服务器上面重新安装了个mysql服务器,还挺费劲儿呢,因为之前都是在我的笔记本上面试验的,它的系统是Ubuntu的,什么路径啊,启动方式啊.都不一样所以这次还是让我纠结了一把:下面把我安装过程中遇到的问题给传上来,首先rpm格式安装就不多说了,主要是mysql的配置文件在:/etc/my.cnf这里,需要修改: 复制代码 代码如下: [mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Default t

随机推荐