我该如何修复挂载在mysql.server stop上并且不会停止的经过酿酒安装的MariaDB? [英] How can I fix brew-installed MariaDB that hangs on `mysql.server stop` and doesn’t stop?
问题描述
此问题与 mariadb服务器:我无法使用`mysql.server stop` 来停止服务器.
This question is not a duplicate of mariadb server: I can't stop the server with `mysql.server stop`.
我不想在启动时运行MariaDB,所以brew services
不能选择.
I don’t want to run MariaDB at boot so brew services
isn’t an option.
MariaDB版本为10.4.11-MariaDB
.
MariaDB version is 10.4.11-MariaDB
.
推荐答案
我认为是罪魁祸首.
在查看mysql.server
(cat /usr/local/bin/mysql.server
)的源代码时,我发现运行mysql.server start
可以像我一样(whoami
)运行mysqld_safe
.
Having a look at the source code of mysql.server
(cat /usr/local/bin/mysql.server
), I discovered that running mysql.server start
runs mysqld_safe
as me (whoami
) which is what I expected.
现在,我还发现运行mysql.server stop
运行的su_kill
函数将su
作为mysql
运行,但由于mysql
用户在macOS上不存在而失败.
Now, I also discovered that running mysql.server stop
runs a su_kill
function that runs su
as mysql
which fails because the mysql
user doesn’t exist on macOS.
user='mysql'
su_kill() {
if test "$USER" = "$user"; then
kill $* >/dev/null 2>&1
else
su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
fi
}
Not sure if I am doing something wrong, but according to the documentation, running mysql.server start
is the right way of starting MariaDB on brew installs.
无论如何,要修补mysql.server stop
,请运行:
Anyhow, to patch mysql.server stop
, run:
cp /usr/local/bin/mysql.server /usr/local/bin/mysql.server.backup
sed -i "" "s/user='mysql'/user=\`whoami\`/g" /usr/local/bin/mysql.server
这篇关于我该如何修复挂载在mysql.server stop上并且不会停止的经过酿酒安装的MariaDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!