当我运行 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 [警告] 使用唯一选项前缀 key_buffer 而不是 key_buffer_size 的输出已被弃用,并将在未来的版本中删除。请改用全名。
我正在运行一个虚拟的 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 “解决”了我的问题,但这似乎不是一个安全的好主意,所以我仍在寻找更好的解决方案。
最佳答案
我可以通过将文件夹的所有权从组根(sudo chown -R mysql:root 文件夹)更改为 mysql 来解决这个问题。一旦我这样做了,一切又开始工作了。
问候
关于mysql - InnoDB : Operating system error number 13 in a file operation not fixed after changing permissions in/var/lib/mysql/or disabling selinux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27733269/