4

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.

Clarkie
  • 7,490
  • 9
  • 39
  • 53
  • 1
    Have you tried `'\`store-staging\`:\`store-beta\`'` or some combination thereof? It is probable that the original backticks are interpreted by the shell and not as an argument to `mysqldbcompare` – Dezza Jan 11 '16 at 13:29
  • Thanks, stick that in an answer and you can have the points – Clarkie Jan 11 '16 at 14:49

1 Answers1

8

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`'

Dezza
  • 1,094
  • 4
  • 22
  • 25