gpt4 book ai didi

mysql - 无法连接到 Mysql 服务器;无法创建/写入 pid 文件

转载 作者:可可西里 更新时间:2023-11-01 06:39:39 24 4
gpt4 key购买 nike

您好,我似乎无法连接到我的 mysql 服务器,我收到以下错误

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

当我检查日志时,它向我显示了以下内容:

130314 12:36:16 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'plugin' is read only
130314 12:36:16 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
130314 12:36:16 InnoDB: Initializing buffer pool, size = 8.0M
130314 12:36:16 InnoDB: Completed initialization of buffer pool
130314 12:36:16 InnoDB: Started; log sequence number 13 1336891001
130314 12:36:16 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/lib/mysql/live.pid' (Errcode: 13)
130314 12:36:16 [ERROR] Can't start server: can't create PID file: Permission denied

最佳答案

我有 mysql 的示例问题。我在 root 权限下运行,但不知道为什么会发生此错误。问题是 mysql 用户没有权限在 /var/run/mysqld 中创建 pid 文件。完整日志可能如下所示:

140812 09:35:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140812 9:35:53 InnoDB: Initializing buffer pool, size = 8.0M
140812 9:35:53 InnoDB: Completed initialization of buffer pool
140812 9:35:53 InnoDB: Started; log sequence number 0 197396648
140812 9:35:53 [ERROR] /usr/libexec/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13)
140812 9:35:53 [ERROR] Can't start server: can't create PID file: Permission denied
140812 09:35:53 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

所以解决方案是将 mysql 用户分配到这个目录:

# chown mysql:mysql /var/run/mysqld

然后启动mysqld

# service mysqld start

关于mysql - 无法连接到 Mysql 服务器;无法创建/写入 pid 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15408643/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com