mysqldbcompare fails with schemas with a '-' in their name

875 Views Asked by At

The following command fails

mysqldbcompare --server1=un:pw@server1 --server2=un:pw@server2 --difftype=sql store-staging:store-beta

with the following error:

mysqldbcompare: error: Cannot parse the specified database(s): 'store-staging:store-beta'. Please verify that the database(s) are specified in a valid format (i.e., db1[:db2]) and that backtick quotes are properly used when required. The use of backticks is required if non alphanumeric characters are used for database names. Parsing the specified database results in db1 = 'store' and db2 = 'store'.

My question is how can I 'escape' the schemas so that they can be run as part of this command?

I have tried all of the following:

'store-staging:store-beta'
"store-staging:store-beta"
`store-staging:store-beta`

'store-staging':'store-beta'
"store-staging":"store-beta"
`store-staging`:`store-beta`

and they all fail.

1

There are 1 best solutions below

0
On BEST ANSWER

It is probable that any backticks you intend for mysqldbcompare are actually being interpreted by the shell before mysqldbcompare actually sees them.

Try including the backticks inside quotes to ensure that they get properly passed, so your command looks something like this:

mysqldbcompare --server1=un:pw@server1 --server2=un:pw@server2 --difftype='`sql store-staging`:`store-beta`'