【发布时间】:2015-02-28 06:14:40
【问题描述】:
当我运行mysql 时,我得到ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 的错误。 mysqld 给出的错误是
150101 12:08:19 [Warning] Can't create test file /var/lib/mysql/lamp-update.lower-test
150101 12:08:19 [Warning] Can't create test file /var/lib/mysql/lamp-update.lower-test
150101 12:08:19 [Warning] One can only use the --user switch if running as root
150101 12:08:19 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
150101 12:08:19 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
150101 12:08:19 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150101 12:08:19 InnoDB: The InnoDB memory heap is disabled
150101 12:08:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150101 12:08:19 InnoDB: Compressed tables use zlib 1.2.8
150101 12:08:19 InnoDB: Using Linux native AIO
150101 12:08:19 InnoDB: Initializing buffer pool, size = 128.0M
150101 12:08:19 InnoDB: Completed initialization of buffer pool
150101 12:08:19 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
sudo mysqld 给出150101 12:11:59 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 的输出
我正在运行一个虚拟 ubuntu linux 服务器。直到昨天,当我收到此错误时,Mysql 一直没有问题。
我尝试将 /var/lib/mysql 中文件的权限设置为 660,将 /var/lib/mysql 中的文件权限设置为 755,并将其子目录设置为 700。然后我运行 sudo chown -R mysql:mysql /var/lib/mysql。然后,我尝试重新启动我的服务器,并运行 mysqld。我遇到了同样的错误。
然后,我尝试通过运行sudo vim /etc/selinux/semanage.conf 并将SELINUX=disabled 作为第一行添加到文件中来禁用selinux。我再次重新启动,并得到同样的错误。
这是我在 stackexchange 或其他网站上看到的任何建议的范围。
有人对我能做什么有任何想法吗?
谢谢,
丹尼尔
编辑:
我通过以 root 身份运行 mysqld “解决了”我的问题,但这似乎不是一个安全明智的好主意,所以我仍在寻找更好的解决方案。
【问题讨论】:
-
你检查apparmor了吗?