通过下述命令启动刚装好的MySQL:
# systemctl start mysqld
结果报错:
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
实际查看日志:
# vi /var/log/mysqld.log
2019-04-19T08:37:22.336206Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server in progress as process 68099
2019-04-19T08:38:31.363684Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: EwUJ?deTl3PS
2019-04-19T08:39:09.308263Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server has completed
2019-04-19T09:35:20.076553Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 68195
2019-04-19T09:35:20.343681Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-04-19T09:35:20.343697Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-04-19T09:35:20.343717Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
...
才知道是权限不够的问题,提权:
# chmod -R 777 /var/lib/mysql
问题解决!