在CentOS上安装MySQL5.7,在配置service mysqld status时报错:
root@centos mysql]# service mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/).
试了很多方法,最后用这个方法搞定了
编辑/etc//mysqld,找到 'start' 模块,添加 --user=root 到 mysqld_safe 的参数即可
case "$mode" in
'start')
# Start daemon
# Safeguard (relative paths, core dumps..)
cd $basedir
echo $echo_n "Starting MySQL"
if test -x $bindir/mysqld_safe
then
# Give extra arguments to mysqld with the file. This script
# may be overwritten at next upgrade.
$bindir/mysqld_safe --user=root --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
# Make lock for RedHat / SuSE
if test -w "$lockdir"
then
touch "$lock_file_path"
fi
exit $return_value
else
log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
fi
;;