CentOS 7 安裝 MySQL 5.6遇到的各種問(wèn)題小結(jié)
在一測(cè)試服務(wù)器(CentOS Linux release 7.2.1511)上安裝MySQL 5.6(5.6.19 MySQL Community Server)時(shí)遇到下面錯(cuò)誤,這個(gè)是因?yàn)镃entOS 7的默認(rèn)數(shù)據(jù)庫(kù)已經(jīng)不再是MySQL了,而是MariaDB. MySQL安裝時(shí)的mysql lib庫(kù)與mariadb的庫(kù)、包沖突了,如下詳情所示(省略了大量日志)
[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的相關(guān)組件,然后刪除mariadb相關(guān)組件。如下所示:
[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
當(dāng)然此處刪除mariadb-libs-5.5.50-1.el7_2.x86_64組件時(shí)遇到依賴(lài)錯(cuò)誤,遂強(qiáng)制刪除該組件,最好使用yum刪除mariadb相關(guān)組件。然后重新安裝MySQL時(shí)遇到"error: MySQL-server-advanced-5.6.20-1.rhel5.x86_64: install failed"錯(cuò)誤,如下所示:
[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
對(duì)這個(gè)錯(cuò)誤有點(diǎn)莫名其妙,卸載MySQL相關(guān)組件后,重新安裝MySQL,發(fā)現(xiàn)缺少Perl相關(guān)模組。如下所示:
[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相關(guān)包(注意:此處安裝MySQL時(shí),沒(méi)有輸出安裝相關(guān)Detail的信息,是因?yàn)镻erl相關(guān)模組沒(méi)有安裝的緣故,此處還漏掉了安裝perl-Data-Dumper)
[root@azrlnx06 jirasetup]# yum install -y perl perl-devel
安裝完P(guān)erl相關(guān)組件后,重新安裝MySQL,如下所示,安裝成功,但是沒(méi)有輸出安裝相關(guān)Detail的信息(因?yàn)闆](méi)有安裝perl-Data-Dumper),啟動(dòng)MySQL報(bào)錯(cuò)
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的錯(cuò)誤日志,然后檢查/var/lib/mysql/azrlnx06.err錯(cuò)誤日志,發(fā)現(xiàn)如下錯(cuò)誤信息:
[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
搜索了一些相關(guān)資料,應(yīng)該是perl-Data-Dumper模組沒(méi)有安裝,導(dǎo)致安裝過(guò)程中,初始化數(shù)據(jù)庫(kù)失敗,所以啟動(dòng)MySQL服務(wù)時(shí),找不到相關(guān)系統(tǒng)表。具體參考官方文檔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:初始化數(shù)據(jù)庫(kù)
[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.
當(dāng)然也可以卸載MySQL,然后重新安裝,就能看到安裝過(guò)程輸出的Detail信息輸出了。
以上所述是小編給大家介紹的CentOS 7 安裝 MySQL 5.6遇到的各種沖突問(wèn)題,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
apache虛擬主機(jī)配置: 二級(jí)目錄訪問(wèn)跳轉(zhuǎn)到其他根文件夾
這篇文章主要介紹了apache虛擬主機(jī)配置: 二級(jí)目錄訪問(wèn)跳轉(zhuǎn)到其他根文件夾,需要的朋友可以參考下2016-11-11ubuntu 設(shè)置靜態(tài)IP的實(shí)現(xiàn)方法
這篇文章主要介紹了ubuntu 靜態(tài)IP的設(shè)定實(shí)現(xiàn)方法的相關(guān)資料,需要的朋友可以參考下2016-10-10詳解linux下fsevents模塊引起的npm ls報(bào)錯(cuò)解決辦法
這篇文章主要介紹了詳解linux下fsevents模塊引起的npm ls報(bào)錯(cuò)解決辦法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2019-04-04Canonical通過(guò)Flutter啟用Linux桌面應(yīng)用程序(推薦)
這篇文章主要介紹了Canonical通過(guò)Flutter啟用Linux桌面應(yīng)用程序,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-07-07教你一招實(shí)現(xiàn)Linux中的文本比對(duì)
這篇文章主要給阿加介紹了關(guān)于Linux下文本比對(duì)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2018-11-11linux磁盤(pán)順序?qū)?、隨機(jī)寫(xiě)的方法
這篇文章主要介紹了linux磁盤(pán)順序?qū)?、隨機(jī)寫(xiě)的方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下2019-08-08總結(jié)Centos7系統(tǒng)加固知識(shí)點(diǎn)
本篇文章給大家詳細(xì)介紹了LINUX中Centos7系統(tǒng)加固的相關(guān)知識(shí)點(diǎn),如果大家對(duì)此有需要跟著學(xué)習(xí)下吧。2018-02-02Centos下升級(jí)Python及Mongodb驅(qū)動(dòng)安裝問(wèn)題
查看python的版本 python -V 如果是2.7以下版本就需要升級(jí)了。這篇文章主要介紹了Centos下升級(jí)Python及Mongodb驅(qū)動(dòng)安裝,需要的朋友可以參考下2019-11-11