错误信息
Starting MySQL.Logging to '/usr/local/mysql/mysqldb/izuf6brtqj5sw2wcwaytc2z.err'.
The server quit without updating PID file (/usr/local/mysql[FAILED]/izuf6brtqj5sw2wcwaytc2z.pid).
日志显示
2020-11-05T01:34:45.067526Z 0 [System] [MY-010116] [Server] /usr/local/mysql/mysql/bin/mysqld (mysqld 8.0.22) starting as process 2672
2020-11-05T01:34:45.070501Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-11-05T01:34:45.080366Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-05T01:34:45.080547Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2020-11-05T01:34:45.080633Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2020-11-05T01:34:45.080719Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2020-11-05T01:34:45.080917Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-11-05T01:34:45.081009Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-11-05T01:34:45.081676Z 0 [System] [MY-010910] [Server] /usr/local/mysql/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.22) MySQL Community Server - GPL.
分析
这是由于权限问题,导致的
解决方案
授予整个mysql文件夹可读可写可执行权限,再把文件权限授予某个角色。
[root@izuf6brtqj5sw2wcwaytc2z mysql]# ll
total 8
drwxr-xr-x 9 root root 4096 Nov 5 09:22 mysql
drwxrwxrwx 6 mysql mysql 4096 Nov 5 09:45 mysqldb
[root@izuf6brtqj5sw2wcwaytc2z mysql]# chmod -R 777 /usr/local/mysql
[root@izuf6brtqj5sw2wcwaytc2z mysql]# ll
total 8
drwxrwxrwx 9 root root 4096 Nov 5 09:22 mysql
drwxrwxrwx 6 mysql mysql 4096 Nov 5 09:45 mysqldb