vps云服务器linux中mysql初始化失败

已关闭留言

我们在linux中安装mysql时遇到的一些报错

问题报错:

mysqld: error while loading shared libraries: libnuma.so.1: cannotopen shared object file: No such file or directory

解决方案:

这个报错是因为缺少了 numactl 如果是centos系统直接安装即可

yum -y install numactl

vps云服务器linux中mysql初始化失败插图

报错信息:

Job for mysqld.service failed because the control process exited witherror code

vps云服务器linux中mysql初始化失败插图1

解决方案:

这个报错因为 /var/lib/mysql 这个路径已经存在/var/lib/mysql,所以无法初始化,删除/var/lib/mysql 后重启Mysql服务即可

删除:

mkdir /var/lib/mysql

chown mysql:mysql /var/lib/mysql

重启:

systemctl start mysql

如果还是失败报错:

localhost.localdomain setroubleshoot[4576]: SELinux is preventing/usr/libexec/mysqld from getattr access on the file/var/lib/mysql/ibdata1. For complete SELinux messages run: sealert-l>

localhost.localdomain platform-python[4576]: SELinux is preventing/usr/libexec/mysqld from getattr access on the file/var/lib/mysql/ibdata1

vps云服务器linux中mysql初始化失败插图2

是因为SElinux权限导致的

解决:

restorecon -Rv /var/lib/mysql

即可解决问题