InnoDB:在更改/ var/lib/mysql /中的权限或禁用selinux后,文件操作中的操作系统错误号13未修复

Dan*_*l F 5 mysql linux ubuntu

当我跑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.
Run Code Online (Sandbox Code Playgroud)

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来"解决"我的问题,但这似乎不是一个好主意安全性,所以我仍然在寻找更好的解决方案.

小智 6

我可以通过从组root(sudo chown -R mysql:root文件夹)将文件夹的所有权更改为mysql来解决这个问题.一旦我这样做了,所有人都开始工作了.

问候


归档时间:

查看次数:

20149 次

最近记录:

7 年,4 月 前