CentOS7安装MySQL冲突和问题解决小结

问题1:

[root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm 
Preparing...                          ################################# [100%] 
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 
file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 
file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 
    ……………………

解决1:

出现以上安装错误列表的原因是:系统已经安装了其他版本的mysql-libs包和mysql数据库文件导致不兼容。

[plain] view plaincopy

  1. [root@localhost install-files]# yum remove mysql-libs 

执行之后,还要详细检查卸载MySQL安装的所有文件,否则在后续安装发生各种错误:CentOS下MySQL的彻底卸载

问题2:

[root@Tony_ts_tian developer]# rpm -ivh MySQL-server-5.5.46-1.el6.x86_64.rpm 
warning: MySQL-server-5.5.46-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY 
Preparing...                ########################################### [100%] 
   1:MySQL-server           ########################################### [100%]

解决2:

从 rpm版本 4.1 开始,在安装或升级软件包时会检查软件包的签名。如果签名校验失败,你就会看到类似以上的错误消息:

注:新的、只针对文件头的签名:错误消息:error: Header V3 DSA signature: BAD, key ID 0352860f

注:没有安装合适的钥匙来校验签名,消息中就会包含 NOKEY:错误消息:warning: V3 DSA signature: NOKEY, key ID 0352860f

由于yum安装了旧版本的GPG keys造成的,解决办法就是(设置后无效):

[plain] view plaincopy

  1. rpm --import /etc/pki/rpm-gpg/RPM* 

此签名是检验安装包的有效性和安装性的。我直接跳过(安装时不校验,加--nosignature参数)检验安装:

[plain] view plaincopy

  1. [root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature 

问题3:

mysqld: unrecognized service

[plain] view plaincopy

  1. [root@Tony_ts_tian init.d]# service mysqld start 
  2. mysqld: unrecognized service 

解决3:

启动脚本文件mysql的目录

[plain] view plaincopy

  1. [root@localhost install-files]# cd /etc/rc.d/init.d/ 
  2. [root@localhost init.d]# ls 
  3. functions  mysql  netconsole  network  README 

并没有mysqld:

推荐:Centos7安装MySQL常见问题

CentOS7下安装MySQL数据库常见问题 1. ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 1. 检查M

[plain] view plaincopy

  1. [root@Tony_ts_tian init.d]# service mysql start 

启动成功:

也可以:

[plain] view plaincopy

  1. [root@Tony_ts_tian init.d]# mv mysql mysqld 
  2. [root@Tony_ts_tian init.d]# service mysqld start 

问题4:

[root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature 
Preparing...                          ################################# [100%] 
Updating / installing... 
   1:MySQL-server-5.6.27-1.el6        ################################# [100%] 
warning: user mysql does not exist - using root 
warning: group mysql does not exist - using root 
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db: 
Data::Dumper

解决4:

[plain] view plaincopy

  1. [root@localhost install-files]# yum install -y perl-Module-Install.noarch 

问题5:

[root@localhost mysql]# service mysql start 
Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).

[plain] view plaincopy

  1. [root@localhost init.d]# cd /var/lib/mysql/ 
  2. [root@localhost mysql]# ll 
  3. total 110620 
  4. -rw-rw----. 1 mysql mysql       56 Oct 11 23:20 auto.cnf 
  5. -rw-rw----. 1 mysql mysql 12582912 Oct 11 23:20 ibdata1 
  6. -rw-rw----. 1 mysql mysql 50331648 Oct 11 23:20 ib_logfile0 
  7. -rw-rw----. 1 mysql mysql 50331648 Oct 11 23:19 ib_logfile1 
  8. -rw-r-----. 1 mysql root      5847 Oct 11 23:20 localhost.localdomain.err 
  9. drwx--x--x. 2 mysql mysql     4096 Oct 11 23:19 mysql 
  10. drwx------. 2 mysql mysql     4096 Oct 11 23:19 performance_schema 
  11. -rw-r--r--. 1 root  root       111 Oct 11 23:19 RPM_UPGRADE_HISTORY 
  12. -rw-r--r--. 1 mysql mysql      111 Oct 11 23:19 RPM_UPGRADE_MARKER-LAST 
  13. drwxr-xr-x. 2 mysql mysql        6 Oct 11 23:19 test 

查看路径:mysql-bin.index多余文件,auto.cnf和performance_schema等不存在(文件不全)。(以上为成功后的mysql数据库目录)

解决5:

因为以前存在的MySQL卸载不干净导致。

删除和卸载(以下是的解决),然后重新安装:CentOS下MySQL的彻底卸载

原文地址:https://www.cnblogs.com/zhoading/p/10277877.html