I'm trying to make a remote mysqldump and afterwards download it with rsync which is all working good, but I also want to log the remote errors I get which I now only see in the terminal output.
I mean errors like this mysqldump: Got error: 1044: Access denied for user 'root'@'localhost' to database 'information_schema' when using LOCK TABLES?
This is the important part of my code:
MYSQL_CMD="mysqldump -u ${MYSQL_USER} -p${MYSQL_PASS} $db -r /root/mysql_${db}.sql"
$SSH -p ${SSH_PORT} ${SSH_USER}@${SSH_HOST} "${MYSQL_CMD}" >> "${LOGFILE}"
In my research I only found solutions for getting the exit code and return values.
I hope someone can give me a hint, thanks in advance.