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
# 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
[mysqladmin]
user = mysql_sysadmin
password =
+
+# used by initscript to fetch slave status
+[mysql]
+user = mysql
+password =