Linux

在 chroot 中執行 mysqld 的文件權限

  • February 23, 2011

我正在嘗試在 chroot 環境中執行 mysqld。這裡的情況。

當我以 root 身份執行 mysqld 時,我可以連接到我的數據庫。但是當我使用 init.d 腳本執行 mysql 時,mysql 給了我一個錯誤。

$ mysql --user=root --password=password
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

所以我想,我需要更改一些文件的文件權限。但哪些?哦,如果您想知道“/var/run/mysqld/mysqld.sock”歸“mysql”使用者所有。

編輯: strace 輸出看起來像這樣

[pid 20603] futex(0xf2cfc4, FUTEX_WAIT_PRIVATE, 685, NULL <unfinished ...>
[pid 20601] rt_sgtimedwait[HUP QUIT ALRM TERM TSTP], NULL, NULL, 8 <unfinished ...>
[pid 20600] futex(0xf2cfc4, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>
[pid 20599] select(0, NULL, NULL, NULL, {0, 278651} <unfinished ...>
[pid 20598] select(0, NULL, NULL, NULL, {0, 42192} <unfinished ...>
[pid 20596] futex(0x21a72708, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>
[pid 20595] futex(0x21a72690, FUTEX_WAIT_PRIVATE, 7, NULL <unfinished ...>
[pid 20594] futex(0x21a72618, FUTEX_WAIT_PRIVATE, 5, NULL <unfinished ...>
[pid 20593] futex(0x21a725a0, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>
[pid 20587] select(12, [10 12], NULL, NULL, NULL <unfinished ...>
[pid 20599] <... select resumed> )        = 0 (Timeout)
[pid 20599] time (NULL)                   = 12982215237
[pid 20599] select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
...........repeats.

這是 schroot 的一個錯誤。mysqld 轉義 chroot 並與系統的 mysqld 互動。

http://ubuntuforums.org/showthread.php?t=1625863 https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/430224

引用自:https://serverfault.com/questions/237832