Bug 142328

Summary: mysqld init script "ping" timeout test fails
Product: [Fedora] Fedora Reporter: Jeremy Laidman <jlaidman>
Component: mysqlAssignee: Tom Lane <tgl>
Status: CLOSED ERRATA QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: abuse, hhorak, j, marco, noa
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-21 22:01:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to init script that works for me
none
Different patch that's a bit less cludgy
none
Patch allows non-anonymous ping check by using username from sysconfig none

Description Jeremy Laidman 2004-12-08 23:09:28 UTC
Description of problem:

After upgrading to mysql-server 3.23.58, the init script reports a
failure to start mysqld, saying "Timeout error occurred trying to
start MySQL Daemon."  Not sure if this is due to removal of anonymous
users, as suggested by comments in the init script.

Version-Release number of selected component (if applicable):

mysql-server 3.23.58

How reproducible:

 stops the running service, then shows message   "ps -ef" shows mysql
process, and "service mysql stop" works too.

Steps to Reproduce:
1. execute "service mysql restart"
2. notice "Timeout error occurred trying to start MySQL Daemon." message
3. execute "ps -ef | grep mysql" and notice that mysqld is running
  
Actual results:

reports "Timeout error occurred trying to start MySQL Daemon."

Expected results:

should report "Starting MySQL:  [ OK ]"

Additional info:

Attaching a patch that works for me.

Comment 1 Jeremy Laidman 2004-12-08 23:12:31 UTC
Created attachment 108158 [details]
Patch to init script that works for me

It seems that I get no STDOUT output for an authentication failure, same as a
failed connection.  Instead, we grab the STDERR and grep for the string "Check
that mysql is running".

Comment 2 Tom Lane 2004-12-09 01:58:28 UTC
Hmm ... that's a bit klugy but it's better than no solution at all. 
Thanks for the suggestion!

Comment 3 Tom Lane 2004-12-09 02:02:47 UTC
*** Bug 137438 has been marked as a duplicate of this bug. ***

Comment 4 Jeremy Laidman 2004-12-09 11:17:05 UTC
I see what you mean.  Rather than look for a failure to connect, and
assuming all is OK when not found, better to test for either 1) ping
works; or 2) ping response with permission denied.

Try this patch instead...

Comment 5 Jeremy Laidman 2004-12-09 11:18:21 UTC
Created attachment 108190 [details]
Different patch that's a bit less cludgy

Comment 7 Bas Mevissen 2004-12-18 18:26:16 UTC
I had the same problem. The cause appeared to be that I had removed
the anonymous users (empty user names) from the databases user list.

Recreating them back (without any privalliges) resolved the problem.
Now my mysqld starts in a few seconds without that error.

I'm not sure if it is safe to have these users exist in a production
database.

I think the solution is to remove the need for having such users in
the database. Maybe just check if the daemon runs or check the log
file for the word ERROR after the last "start"

Comment 8 Bas Mevissen 2004-12-18 18:29:53 UTC
I just read that this is already discussed in (137438), see comment #3
in this report.

I missed that report in my query :-(

Comment 9 Tom Lane 2004-12-22 00:17:54 UTC
I have applied a patch for this, based on Jeremy's work, in rawhide
(mysql 4.1.7-8) --- I'll work on rolling it into the existing release
branches later.

Comment 10 Richard Hughes 2004-12-28 23:47:59 UTC
Created attachment 109161 [details]
Patch allows non-anonymous ping check by using username from sysconfig

I found this too. This is due to our security policy disallowed anonymous
access to the mysql server. 

To stop this error appearing every time I boot, I can just change the init.d
script with a new username:

ping="/usr/bin/mysqladmin -ucorrect_user ping"

This username (and optionally password) should really be set in a sysconfig
variable, not the startup script, just like pand and dhcpd do.

This optional new file /etc/sysconfig/mysqld should be mode 600.
----------------------------------------------------
# Username and password for mysql ping
USERNAME=pinguser
#PASSWORD=secretpassword
---------------------------------------------------

I understand it's a slightly different issue, but similar enough to stay within
this bug. Tell me if I'm wrong, or if there's a better way to fix it.

Comment 11 Tom Lane 2005-01-05 19:15:26 UTC
I have pushed out a fix for FC3 in mysql-3.23.58-14.  It will still
need to be fixed in RHEL4.

Comment 12 Tom Lane 2005-03-21 22:01:43 UTC
This is now fixed in pending releases for all branches.