因此,每当我尝试启动/安装 MySQL 服务器时,它都会崩溃并显示此日志
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
2019-01-15T05:42:42.237951Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-01-15T05:42:42.239858Z 0 [Note] mysqld (mysqld 5.7.24-0ubuntu0.18.04.1) starting as process 25348 ...
2019-01-15T05:42:42.242935Z 0 [ERROR] failed to set datadir to /var/lib/mysql/
2019-01-15T05:42:42.242951Z 0 [ERROR] Aborting
2019-01-15T05:42:42.242968Z 0 [Note] Binlog end
2019-01-15T05:42:42.243042Z 0 [Note] mysqld: Shutdown complete
现在,它谈论的这个文件夹是 /var/lib/mysql,现在请等待。我的很多应用程序在启动时崩溃,谈论 var 是“世界可写”。我记得我意外地在 /var 上运行了 chmod -R 777。所以,我认为这是整个 /var 的问题。如果有人能以某种方式找出原始权限并能帮助我解决这个问题,我将非常感激,当我运行 ls -la /var 时,我得到了
ep1c_m1n10n@vault1:/$ ls -la /var
total 64
drwxrwxrwx 16 root root 4096 Aug 18 23:35 .
drwxr-xr-x 29 root root 4096 Jan 15 05:15 ..
drwx------ 2 root root 4096 Jan 14 06:25 backups
drwx------ 17 root root 4096 Jan 15 02:53 cache
drwx------ 2 root root 4096 Jan 15 04:56 crash
drwx------ 51 root root 4096 Jan 15 05:11 lib
drwx--S--- 2 root staff 4096 Apr 24 2018 local
lrwxrwxrwx 1 root root 9 Apr 26 2018 lock -> /run/lock
drwx------ 19 root syslog 4096 Jan 15 04:56 log
drwx--S--- 2 root mail 4096 Apr 26 2018 mail
drwx------ 3 root root 4096 Nov 29 01:42 opt
lrwxrwxrwx 1 root root 4 Apr 26 2018 run -> /run
drwx------ 3 root root 4096 Jul 16 2018 snap
drwx------ 8 root root 4096 Jan 13 12:17 spool
drwx------ 10 root root 4096 Jan 15 05:39 tmp
drwx------ 3 root bin 4096 Jul 16 19:42 usermin
drwx------ 5 root bin 4096 Jan 15 04:49 webmin
drwxrwxrwx 3 root root 4096 Jul 16 2018 www
答案1
首先 /var 需要
drwxr-xr-x 12 root root 4096 Mar 23 2016 var
我们都有的 /var 的内容我有这个:
drwxrwsr-x 2 root staff 4096 Apr 11 2014 local
drwxr-xr-x 2 root root 4096 Apr 16 2014 opt
lrwxrwxrwx 1 root root 9 Jun 13 2014 lock -> /run/lock
lrwxrwxrwx 1 root root 4 Jun 13 2014 run -> /run
drwxrwsrwt 2 root mail 4096 Apr 10 2016 mail
drwxr-xr-x 6 root root 4096 Aug 2 2016 spool
drwxr-xr-x 11 root root 4096 Aug 2 2016 cache
drwxr-xr-x 57 root root 4096 Jul 25 2017 lib
drwxrwxrwt 2 root root 4096 Jul 27 06:25 crash
drwxr-xr-x 2 root root 4096 Jul 28 06:25 backups
drwxrwxrwt 2 root root 4096 Nov 7 14:55 tmp
drwxrwxr-x 12 root syslog 4096 Nov 19 06:25 log
- 我的 www 是一个符号链接,所以不包括那个。
/var 上的 chmod -R 777
你做的还不止这些。你展示的许多文件和目录都没有设置 777。