gpt4 book ai didi

mysql - 而mysql可以在/var/lib中创建具有drwxr-xr-x权限的目录?

转载 作者:太空宇宙 更新时间:2023-11-04 05:11:40 24 4
gpt4 key购买 nike

当我通过docker使用mysql时,我发现一个问题:在mysql配置文件my.cnf中,我设置如下:

[mysqld]
datadir=/var/lib/mysql
user=Tim
...

但是你知道/var/lib的权限是755,相当于drwxr-xr-x,只有root用户才能在这个目录下创建文件。但是为什么mysql可以用Tim用户在/var/lib下创建文件呢?

最佳答案

启动脚本仍然以 Linux root 身份运行,然后切换:

Run the mysqld server as the user having the name user_name or the numeric user ID user_id. (“User” in this context refers to a system login account, not a MySQL user listed in the grant tables.)

This option is mandatory when starting mysqld as root. The server changes its user ID during its startup sequence, causing it to run as that particular user rather than as root.

取自 --user documentation .

关于mysql - 而mysql可以在/var/lib中创建具有drwxr-xr-x权限的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54573521/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com