Bug #27054 SIGHUP causes "FLUSH PRIVILEGES" and other undocumented behavior
Submitted: 12 Mar 2007 17:26 Modified: 8 Jan 2008 23:05
Reporter: Matthew Montgomery Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:All OS:Linux (Linux 2.6, Solaris 10)
Assigned to: Paul DuBois CPU Architecture:Any
Tags: grants, SIGHUP

[12 Mar 2007 17:26] Matthew Montgomery
Description:
If mysqld is started with skip-grant-tables and SIGHUP is sent to mysqld, it will reload the grants tables.

Currently the documentation only indicates that SIGHUP will effectively result in "FLUSH LOGS".

http://dev.mysql.com/doc/refman/5.0/en/flush.html

Also a "Status information:" block is dumped to the error log resembling the following.

Status information:

Current dir: /home/matt/sandbox/mysql50/data/
Running threads: 0  Stack size: 196608
Current locks:

Key caches:
default
Buffer_size:       8388600
Block_size:           1024
Division_limit:        100
Age_limit:             300
blocks used:             0
not flushed:             0
w_requests:              0
writes:                  0
r_requests:              0
reads:                   0

handler status:
read_key:            0
read_next:           0
read_rnd             0
read_first:          1
write:               0
delete               0
update:              0

Table status:
Opened tables:          5
Open tables:            0
Open files:             7
Open streams:           0

Alarm status:
Active alarms:   1
Max used alarms: 2
Next alarm time: 67

While this is nice information it's not documented anywhere that I can find.

How to repeat:
matt@matt-lnx:~/sandbox/mysql50> sudo ./bin/mysqld_safe --defaults-file=./my.cnf &
[1] 22433
Starting mysqld daemon with databases from /home/matt/sandbox/mysql50/data

matt@matt-lnx:~/sandbox/mysql50> ./bin/mysql -e "show grants" -S /tmp/mysql50.sock
ERROR 1290 (HY000) at line 1: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

matt@matt-lnx:~/sandbox/mysql50>  sudo kill -HUP `pidof mysqld`

matt@matt-lnx:~/sandbox/mysql50> ./bin/mysql -e "show grants" -S /tmp/mysql50.sock
ERROR 1045 (28000): Access denied for user 'matt'@'localhost' (using password: NO)

Suggested fix:
All behaviors of mysqld upon SIGHUP should be documented.

Perhaps also create log entry for "Recieved SIGHUP:" before processing the signal.
[12 Mar 2007 18:26] MySQL Verification Team
For some it is preferred that SIGHUP not trigger reloading of the grants.  Only FLUSH PRIVILEGES should.
[30 Mar 2007 20:06] Konstantin Osipov
Stefan, we should be able to answer questions Paul might have.
[8 Jan 2008 23:05] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

The server admin chapter now contains a section that indicates how the server responds to signals:

http://dev.mysql.com/doc/refman/5.0/en/server-signal-response.html