Fix escaped backslashes in grants

* Mysql uses the underscore character to represent a single character
  wildcard.
* A grant on table `the_database`.* would match `theAdatabase`.*, so
  underscores must be escaped to avoid this match.
* The output from mysql escapes special characters (\n, \t, \0, and \\),
  but the input does not need to be escaped.
* In order for the provider to compare the tables, the output of
  mysql -NBe <query> must have \\ substituted with \.
Improve checks for MySQL user's name.

As per http://dev.mysql.com/doc/refman/5.5/en/identifiers.html , MySQL
allows for more than '\w-'. This commit improves the check to ensure
that:
 - if username only contains [0-9a-zA-Z$_], it might be quoted. It is
   not a requirement though
 - if username contains anything else, it MUST be quoted

I kept 2 checks, but the 2nd one can probably be removed (I can't find a
username which match the 2nd one but not the first.)
Merge pull request #588 from maxenced/fix-mysql-user-allowed-char

Improve checks for MySQL user's name.
Merge pull request #594 from skroll/escape_backslash

Fix escaped backslashes in grants