From: Elan Ruusamäe Date: Mon, 22 Apr 2013 10:23:25 +0000 (+0300) Subject: use mysqld.conf when fetching slave status X-Git-Tag: auto/th/percona-server-5.7.19-17.1~107 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=ed3eec1bf2920f057c1571ccacb21dd2cdf9209d;p=packages%2Fpercona-server.git 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 --- diff --git a/mysql.init b/mysql.init index 9327683..f5cc30f 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 9df699e..c4f7331 100644 --- a/mysqld.conf +++ b/mysqld.conf @@ -222,3 +222,8 @@ innodb_log_buffer_size=1M [mysqladmin] user = mysql_sysadmin password = + +# used by initscript to fetch slave status +[mysql] +user = mysql +password =