InnoDB:更改/var/lib/mysql/中的权限或禁用selinux后,文件操作中的操作系统错误号13未修复
当我运行InnoDB:更改/var/lib/mysql/中的权限或禁用selinux后,文件操作中的操作系统错误号13未修复,mysql,linux,ubuntu,Mysql,Linux,Ubuntu,当我运行mysql时,我得到的错误是error 2002(HY000):无法通过socket'/var/run/mysqld/mysqld.sock'(2)连接到本地mysql服务器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/l
mysql
时,我得到的错误是error 2002(HY000):无法通过socket'/var/run/mysqld/mysqld.sock'(2)
连接到本地mysql服务器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
给出了使用唯一选项前缀key\u buffer而不是key\u buffer\u size的150101 12:11:59[警告]的输出。不推荐使用该选项,并将在将来的版本中删除。请改用全名。
我正在运行一个虚拟的ubuntu linux服务器。Mysql一直工作没有问题,直到昨天,当我得到这个错误
我尝试将/var/lib/mysql中的文件权限设置为660,/var/lib/mysql中的文件权限设置为755,其子目录权限设置为700。然后我运行了sudo chown-R mysql:mysql/var/lib/mysql
。然后,我尝试重新启动服务器,并运行mysqld。我也犯了同样的错误
然后,我尝试通过运行sudovim/etc/selinux/semanage.conf
并将selinux=disabled
作为第一行添加到文件中来禁用selinux。我再次重新启动,并得到相同的错误
这是我在stackexchange或其他网站上看到的任何建议的范围
有人知道我能做什么吗
谢谢,
丹尼尔
编辑:
我通过以root用户身份运行mysqld“解决”了我的问题,但从安全角度来看,这似乎不是一个好主意,因此我仍在寻找更好的解决方案。我可以通过将文件夹的所有权从组root(sudo chown-R mysql:root folder)更改为mysql来解决这个问题。一旦我这样做了,一切又开始工作了
首先,在下面键入这些命令
- chown-R root:mysql/opt/lampp/var/mysql
- chown-R root:mysql/opt/lampp/mysql
- chmod-R 777/opt/lampp/var/mysql
- chmod-R 777/opt/lampp/mysql
这对我来说很有效。我也遇到了这个问题。我使用了“setEnforce0”这个命令,然后mysql服务成功启动。也许你可以试试。祝你好运,我启用了SELinux,通过禁用SELinux,我能够启动服务 要禁用SELlinux,请编辑 /etc/sysconfig/selinux 设定
SELINUX=disabled
重新启动并用命令验证
sestatus
在我的情况下,文件夹权限是
chown -R mysql:mysql /mnt/efs/fs1/mysql
chmod -R 750 /mnt/efs/fs1/mysql
其中/mnt/efs/fs1/mysql是我的数据目录检查这些链接,它可能会帮助您检查apparmor吗?请看这个答案这是可行的,但与mysql根用户具有相同的安全风险。这意味着,如果DB存在漏洞,测试人员就拥有您的服务器。