Bug 142328 - mysqld init script "ping" timeout test fails
Summary: mysqld init script "ping" timeout test fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mysql
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tom Lane
QA Contact: David Lawrence
URL:
Whiteboard:
: 137438 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-12-08 23:09 UTC by Jeremy Laidman
Modified: 2013-07-03 03:03 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-03-21 22:01:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch to init script that works for me (1.16 KB, patch)
2004-12-08 23:12 UTC, Jeremy Laidman
no flags Details | Diff
Different patch that's a bit less cludgy (1.23 KB, text/plain)
2004-12-09 11:18 UTC, Jeremy Laidman
no flags Details
Patch allows non-anonymous ping check by using username from sysconfig (981 bytes, patch)
2004-12-28 23:47 UTC, Richard Hughes
no flags Details | Diff

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.


Note You need to log in before you can comment on or make changes to this bug.