665d94
Adjust the mysql-log-rotate script in several ways:
665d94
665d94
* Use the correct log file pathname for Red Hat installations.
665d94
* Enable creation of the log file by logrotate (needed since
665d94
  /var/log/ isn't writable by mysql user); and set the same 640
665d94
  permissions we normally use.
665d94
* Comment out the actual rotation commands, so that user must edit
665d94
  the file to enable rotation.  This is unfortunate, but the fact
665d94
  that the script will probably fail without manual configuration
665d94
  (to set a root password) means that we can't really have it turned
665d94
  on by default.  Fortunately, in most configurations the log file
665d94
  is low-volume and so rotation is not critical functionality.
665d94
665d94
See discussions at RH bugs 799735, 547007
665d94
* Note they are from Fedora 15 / 16
665d94
665d94
Update 3/2017
665d94
* it would be big unexpected change for anyone upgrading, if we start shipping it now.
665d94
  Maybe it is good candidate for shipping with MariaDB 10.2 ?
665d94
* the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost
665d94
  during flushing, the operation is not atomic.
665d94
  We should not ship it in that state
665d94
665d94
Update 6/2018
665d94
* the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is
665d94
  beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can.
665d94
* Submited as PR: https://github.com/MariaDB/server/pull/807
665d94
2c6cfb
--- mariadb-10.3.19/support-files/mysql-log-rotate.sh	2019-11-03 17:03:27.000000000 +0100
2c6cfb
+++ mariadb-10.3.19/support-files/mysql-log-rotate.sh_patched	2019-11-06 15:07:54.205379672 +0100
2c6cfb
@@ -3,23 +3,10 @@
2c6cfb
 # in the [mysqld] section as follows:
665d94
 #
2c6cfb
 # [mysqld]
2c6cfb
-# log-error=@localstatedir@/mysqld.log
665d94
-#
665d94
-# If the root user has a password you have to create a
665d94
-# /root/.my.cnf configuration file with the following
665d94
-# content:
665d94
-#
665d94
-# [mysqladmin]
665d94
-# password = <secret> 
665d94
-# user= root
665d94
-#
665d94
-# where "<secret>" is the password. 
665d94
-#
665d94
-# ATTENTION: This /root/.my.cnf should be readable ONLY
665d94
-# for root !
2c6cfb
+# log-error=@LOG_LOCATION@
665d94
 
665d94
-@localstatedir@/mysqld.log {
665d94
-        # create 600 mysql mysql
665d94
+@LOG_LOCATION@ {
665d94
+        create 600 mysql mysql
665d94
         notifempty
2c6cfb
         daily
665d94
         rotate 3
665d94
@@ -27,11 +14,9 @@
665d94
         compress
665d94
     postrotate
665d94
 	# just if mysqld is really running
665d94
-	if test -x @bindir@/mysqladmin && \
665d94
-	   @bindir@/mysqladmin ping &>/dev/null
665d94
-	then
665d94
-	   @bindir@/mysqladmin --local flush-error-log \
665d94
-              flush-engine-log flush-general-log flush-slow-log
665d94
-	fi
665d94
+        if [ -e @PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid ]
665d94
+        then
665d94
+           kill -1 $(<@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid)
665d94
+        fi
665d94
     endscript
665d94
 }