Centos6.5 uses the rpm package to install MySQL8.0.22. After the installation is complete, the database initialization error is reported: Failed to open the bootstrap file /var/lib/mysql-files/install-validate-password-plugin.2SvMB2.sql
Look at the log first, the specific error is as follows:
# 安装完成后,启动报错
[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 6387
2021-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.sql
2021-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] Aborting
2021-01-10T00:46:01.353622Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22) MySQL Community Server - GPL.
Because I have installed various versions of MySQL many times before, I have never encountered this error. The server has not installed MySQL before, and it started directly without modifying any default configuration after installation. I was also confused.
Then various Baidus still couldn't find the answer. Finally, check the installation record to find the problem, as follows:
[root@nybzapp2 tools]# ll
total 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: NOKEY
Preparing... ########################################### [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: NOKEY
error: 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: NOKEY
error: 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: NOKEY
Preparing... ########################################### [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: NOKEY
Preparing... ########################################### [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: NOKEY
Preparing... ########################################### [100%]
1:mysql-community-client ########################################### [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: NOKEY
Preparing... ########################################### [100%]
1:mysql-community-server ########################################### [100%]
After decompressing the installation package, there are a total of 8 rpm packages, and by solving the dependencies, I successfully installed mysql-community-server after installing only 5, so I didn’t notice that I installed mysql-community-libs-compat-8.0. 22-1.el6.x86_64.rpm
Install mysql-community-libs-compat-8.0.22-1.el6.x86_64.rpm package
[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: NOKEY
Preparing... ########################################### [100%]
1:mysql-community-libs-co########################################### [100%]
Start the database again:
[root@nybzapp2 tools]# service mysqld start
Starting mysqld: [ OK ]
[root@nybzapp2 tools]#
problem solved