1241天 Edwiin

还好有你,再见如初。

Linux下启动MySQL服务出现问题

发布于 3个月前 / 72 次围观 / 0 条评论 / Linux / Edwiin

遇到疑问

我是用yum install mysql mysql-server安装的
用service mysqld start启动服务时,出现如下错误:

Redirecting to /bin/systemctl start mysqld.service Failed to issue method call: Access denied

用systemctl start mysql.service时,出现如下错误:

Failed to issue method call: Unit mysql.service failed to load: No such file or directory. See system logs and 'systemctl status mysql.service' for details.

直接输入mysql出现如下错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解决办法

mysql的拥有者是root,而mysql是用mysql用户身份执行当然写不进去了,是系统权限的问题,输入

chown -R mysql:mysql /var/lib/mysql/

就可以了,安装时没有指明用mysql用户。