MySQL Forums
Forum List  »  Quality Assurance

Call to mysqld_safe in mysql.server script keeps script running.
Posted by: Levi Dhuyvetter
Date: June 06, 2020 12:36PM


Apologies if this is the wrong thread to post this. I was about to file a bug report but I'm net entirely sure this is a bug.

I'm trying to start MySQL on a remote machine using libssh2. When using the command "mysql.server start" it keeps running and never returns a status code.

Looking at the mysql.server script, the problem seems to be related to this line where mysqld_safe is called:

$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &

I can see at the end the output being redirected to /dev/null and the call being run on the background.

However, I think my call to mysql.server from libssh2 keeps running because of some kind of activity on the error output.

Changing it as follows, redirecting stderr to stdout to also be discarded fixes this problem:

$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &

I'm not too familiar with this kind of stuff so apologies if anything doesn't make sense. I'm just assuming that mysql.server script is only supposed to initiate startup and exit rather than monitoring error output but please tell me if I'm wrong.

Options: ReplyQuote

Written By
Call to mysqld_safe in mysql.server script keeps script running.
June 06, 2020 12:36PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.