[packages/mysql/MYSQL_5_0] use mysqld.conf when fetching slave status

glen glen at pld-linux.org
Thu Nov 14 10:22:01 CET 2013


commit cc0b2586010cd028b969c5dfd94a31ba906530d8
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Apr 22 13:23:25 2013 +0300

    use mysqld.conf when fetching slave status
    
    we need -u mysql to get super privileges, this is the simpliest way (and
    works by default in pld)
    
    service mysql status gives such error
    ERROR 1227 (42000) at line 1: Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation
    
    which works fine from commandline if you have ~/.my.cnf specifing user=mysql:
    $ mysql -S /var/lib/mysql/mysqldb/mysql.sock -e show slave status\G
    
    fine tuning could add special user for this purpose only

 mysql.init  | 2 +-
 mysqld.conf | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/mysql.init b/mysql.init
index 12f692d..6fd8002 100755
--- a/mysql.init
+++ b/mysql.init
@@ -359,7 +359,7 @@ mysqlstop() {
 # uses MYSQL_SOCKET - path to mysql socket
 slave_status() {
 	# see if slave status can be reported
-	local err=0 slave_status=$(mysql -S $MYSQL_SOCKET -e 'show slave status\G')
+	local err=0 slave_status=$(mysql --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" -e 'show slave status\G')
 	if [ -z "$slave_status" ]; then
 		# slave not setup
 		return
diff --git a/mysqld.conf b/mysqld.conf
index 80a4dfe..8fb97f4 100644
--- a/mysqld.conf
+++ b/mysqld.conf
@@ -237,3 +237,8 @@ innodb_log_buffer_size=1M
 [mysqladmin]
 user        = mysql_sysadmin
 password    =
+
+# used by initscript to fetch slave status
+[mysql]
+user        = mysql
+password    =
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/mysql.git/commitdiff/837104a095cbc1730b0c4e8264d7e6311faa3cbf



More information about the pld-cvs-commit mailing list