mysqldbcompare 失败,模式名称中带有“-”

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

以下命令失败

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

出现以下错误:

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

我的问题是如何 'escape' 架构,以便它们可以 运行 作为此命令的一部分?

我已经尝试了以下所有方法:

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

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

他们都失败了。

很可能您打算用于 mysqldbcompare 的任何反引号在 mysqldbcompare 实际看到它们之前实际上已被 shell 解释。

尝试在引号内包含反引号以确保它们被正确传递,所以您的命令看起来像这样:

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