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