add patch from matthew palmer to enhance mysql database selection (Closes: #452039)
[matthijs/upstream/backupninja.git] / handlers / mysql.in
index 64b6f492188b31429ceb9249abd9c748fd68d99c..defb72aa8aeb98713d807024a5a488bcbca43cdd 100644 (file)
@@ -238,7 +238,7 @@ then
                fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?"
            fi
        else
-               databases=`echo 'show databases' | su $user -c "$MYSQL $defaultsfile" | grep -v Database`
+               databases=$(su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d')
                if [ $? -ne 0 ]
                then
                    fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?"