最近在搭建JumpServer堡垒机(搭建步骤会再写一篇博客),JumpServer的数据库用的mysql,于是在https://dev.mysql.com/downloads/repo/yum/下载CentOS8对应的mysql版本
按照菜鸟教程上的步骤:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum update yum install mysql-server
#设置权限
chown mysql:mysql -R /var/lib/mysql
mysqld --initialize
启动 MySQL:
systemctl start mysqld
到了启动步骤就翻车了
根据报错信息,建议使用systemctl status mysqld.service 和 journalctl -xe报错原因,如下图所示,基本没什么卵用
咱们直接看/var/log/mysql/目录下的mysql日志
vim /var/log/mysql/mysqld.log
日志报错ibdatal文件必须为可写,也就是说现在它没有可写权限,所以导致mysql启动失败。ibdatal文件在/var/lib/mysql下,直接给mysql目录赋予777(读、写、执行)权限
chmod -R 777 /var/lib/mysql
启动mysql
systemctl start mysqld
查看mysql状态