MySQL启动报错: Failed to start LSB: start and stop MySQL.与连接而数据库报错:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
今天在配置部署一台MySQL服务器,安装成功后,自动启动了 mysql服务,此时默认的mysql的data是在/var/lib/mysql下的,我想把他改成/mysql/mysql-data下,于是
systemctl stop mysql
ss -antup | grep mysql
已经停止mysql服务
修改配置文件
vim /etc/my.cnf
datadir=/mysql/mysql-data
socket=/mysql/mysql-data/mysql.sock
mkdir -p /mysql/mysql
启动服务:systemctl start mysql
结果报错: Failed to start LSB: start and stop MySQL.
经过一番排查和原来的data目录一对比后,发现是权限问题
查看配置文件
ps -ef | grep mysql,发现启动用户