[packages/percona-server/v5.0.x: 186/202] use mysqld.conf when fetching slave status

glen glen at pld-linux.org
Wed Oct 21 16:24:40 CEST 2015


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/percona-server.git/commitdiff/431f68fe79a66d5dfdd53f2655709e6c925fbc22



More information about the pld-cvs-commit mailing list