Improve change detection in mysql_variables

mysql_variables bindly executes a SET var = value query even when
the variable already has the requested value.

With this patch the query is executed only if the current value is
different to the requested one.
Merge pull request #4568 from mmoya/features

Improve change detection in mysql_variables