Bug #69783 mysqldbcompare cannot use passwords that contain hyphens (-)
Submitted: 18 Jul 2013 17:50 Modified: 18 Jul 2013 21:26
Reporter: Sergio Bobillier Email Updates:
Status: Closed Impact on me:
Category:MySQL Utilities Severity:S2 (Serious)
Version:1.0.3rc1 OS:Linux (Ubuntu 12.10)
Assigned to: CPU Architecture:Any
Tags: MySQL Utilities mysqldbcompare

[18 Jul 2013 17:50] Sergio Bobillier
When using mysqldbcompare to compare two databases among servers you have to specify the log-in credentials for each server in <user>:<passwd>@<host>:<port>:<socket> format.

If the password contains a hyphen (-) the connection will always fail because the password is "wrong":

    server1 on localhost: ... ERROR: Cannot connect to the server1 server.
    Error 1045: Access denied for user 'root'@'localhost' (using password: YES)

I tried to escape the hyphen by surrounding the connection string with single and double quotation marks using a backslash but it didn't work.

The documentation doesn't say how to escape passwords with special characters.

How to repeat:
1. Create a user and give it a password with a hyphen in it, for example, "my-password"

2. Run a mysqldbcompare command like this one:

mysqldbcompare --server1=user:my-password@localhost:3306 db1:db2

(the databases you are going to compare don't have to exist since the connection will fail before mysqldbcompare have the chance to check if the databases exist).

What is really important here is that the password contains a hyphen (-) in it.
[18 Jul 2013 21:26] Chuck Bell
Fixed in release-1.2.2. WB version 5.2.44+

Use quotes around the string. For example, --server="user:'pass-word'@localhost"

You can download the latest version from dev.mysql.com.