本文共 5570 字,大约阅读时间需要 18 分钟。
centos6.5使用rpm包安装MySQL8.0.22,安装完成后,启动数据库初始化报错:Failed to open the bootstrap file /var/lib/mysql-files/install-validate-password-plugin.2SvMB2.sql
先看日志,具体报错如下:
# 安装完成后,启动报错[root@nybzapp2 tools]# service mysqld start初始化 MySQL 数据库: [失败][root@nybzapp2 tools]# cat /var/log/mysqld.log 2021-01-10T00:45:48.811506Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.22) initializing of server in progress as process 63872021-01-10T00:45:49.112961Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.2021-01-10T00:45:53.812354Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.2021-01-10T00:45:59.156489Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-000029 - File '/var/lib/mysql-files/install-validate-password-plugin.2SvMB2.sql' not found (OS errno 13 - Permission denied)2021-01-10T00:45:59.156799Z 0 [ERROR] [MY-010455] [Server] Failed to open the bootstrap file /var/lib/mysql-files/install-validate-password-plugin.2SvMB2.sql2021-01-10T00:45:59.156808Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.2021-01-10T00:45:59.156813Z 0 [ERROR] [MY-010119] [Server] Aborting2021-01-10T00:46:01.353622Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22) MySQL Community Server - GPL.
因为之前安装过许多次各个版本的MySQL,从未遇到此错误。服务器之前也没有安装过MySQL,而且安装后并没有修改任何默认配置直接启动的,我也是一脸懵逼了。
然后各种百度,仍然是找不到答案。最后,查看安装记录找到了问题所在,如下:
[root@nybzapp2 tools]# lltotal 224960-rw-r--r--. 1 7155 31415 51091896 9月 25 16:38 mysql-community-client-8.0.22-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 243972 9月 25 16:39 mysql-community-client-plugins-8.0.22-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 760036 9月 25 16:39 mysql-community-common-8.0.22-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 8689756 9月 25 16:39 mysql-community-devel-8.0.22-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 4972912 9月 25 16:39 mysql-community-libs-8.0.22-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 1771668 9月 25 16:39 mysql-community-libs-compat-8.0.22-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 578118000 9月 25 17:40 mysql-community-server-8.0.22-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 263507824 9月 25 17:43 mysql-community-test-8.0.22-1.el6.x86_64.rpm[root@nybzapp2 tools]# rpm -ivh mysql-community-common-8.0.22-1.el6.x86_64.rpm warning: mysql-community-common-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:mysql-community-common ########################################### [100%][root@nybzapp2 tools]# rpm -ivh mysql-community-server-8.0.22-1.el6.x86_64.rpm warning: mysql-community-server-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYerror: Failed dependencies: mysql-community-client(x86-64) >= 8.0.11 is needed by mysql-community-server-8.0.22-1.el6.x86_64[root@nybzapp2 tools]# rpm -ivh mysql-community-client-8.0.22-1.el6.x86_64.rpm warning: mysql-community-client-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYerror: Failed dependencies: mysql-community-client-plugins = 8.0.22-1.el6 is needed by mysql-community-client-8.0.22-1.el6.x86_64 mysql-community-libs(x86-64) >= 8.0.11 is needed by mysql-community-client-8.0.22-1.el6.x86_64[root@nybzapp2 tools]# rpm -ivh mysql-community-client-plugins-8.0.22-1.el6.x86_64.rpm warning: mysql-community-client-plugins-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:mysql-community-client-########################################### [100%][root@nybzapp2 tools]# rpm -ivh mysql-community-libs-8.0.22-1.el6.x86_64.rpm warning: mysql-community-libs-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:mysql-community-libs ########################################### [100%][root@nybzapp2 tools]# rpm -ivh mysql-community-client-8.0.22-1.el6.x86_64.rpm warning: mysql-community-client-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:mysql-community-client ########################################### [100%][root@nybzapp2 tools]# rpm -ivh mysql-community-server-8.0.22-1.el6.x86_64.rpmwarning: mysql-community-server-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:mysql-community-server ########################################### [100%]
解压安装包后,一共是8个rpm包,而我通过解决依赖,只安装了5个就成功安装了mysql-community-server,所以没注意少了安装了mysql-community-libs-compat-8.0.22-1.el6.x86_64.rpm
安装mysql-community-libs-compat-8.0.22-1.el6.x86_64.rpm包
[root@nybzapp2 tools]# rpm -ivh mysql-community-libs-compat-8.0.22-1.el6.x86_64.rpm warning: mysql-community-libs-compat-8.0.22-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:mysql-community-libs-co########################################### [100%]
再次启动数据库:
[root@nybzapp2 tools]# service mysqld startStarting mysqld: [ OK ][root@nybzapp2 tools]#
问题解决
转载地址:http://euwmf.baihongyu.com/