简体   繁体   English

运行mysqldump时出现“未知选项-W”错误

[英]'unknown option -W' error when running mysqldump

I am trying to create a backup of a database. 我正在尝试创建数据库的备份。

mysqldump -u ost-v1-11-x -xWt1z0*8 ost-v1-11-x_ > /master-db/ost-v1-11-x__.sql

But this results in an error: 但这会导致错误:

mysqldump: unknown option '-W'

I have verified all of the paths / names / password. 我已经验证了所有路径/名称/密码。

I can use the same code to successfully backup another database on the same server and within the same user account. 我可以使用相同的代码在同一服务器上和同一用户帐户中成功备份另一个数据库。

I have tried Googling the '-W' error to no avail. 我尝试使用Google搜索“ -W”错误无济于事。

When you prefix a flag with a single - , it's called a clustered option . 当标记以单-前缀时,称为集群选项 Each letter following the - is interpreted as a flag. 继每个字母-被解释为标志。

This is how you can use UNIX/Linux commands like: 这就是使用UNIX / Linux命令的方式,例如:

ls -lar

This means the same thing as: 这意味着与以下内容相同:

ls -l -a -r

So when you used this flag argument: 因此,当您使用此标志参数时:

-xWt1z0*8

It assumed you mean you were using a cluster of options: 它假设您是在使用一组选项:

-x -W -t -1 -z -0 -* -8

The -x option is recognized by mysqldump. mysqldump可以识别-x选项。 It's a short alias for --lock-all-tables . 这是--lock-all-tables的简称。

Then the program proceeded to the next option you gave: -W . 然后程序进入您给的下一个选项: -W On Windows, this is a short alias for the --pipe option, but on UNIX/Linux/Mac, the option is not recognized. 在Windows上,这是--pipe选项的简短别名,但是在UNIX / Linux / Mac上,该选项无法识别。

I'm not sure what you intended by the option -xWt1z0*8 but I would guess that's supposed to be a password. 我不确定-xWt1z0*8选项的-xWt1z0*8但我想应该是密码。 If so, you should use the -p flag, followed by your password. 如果是这样,则应使用-p标志,然后输入密码。

mysqldump -u ost-v1-11-x -pxWt1z0*8 ...

Here's where mysqldump does something that breaks the conventions for clustered options. 在这里mysqldump所做的事情打破了群集选项的约定。 The -p option is prefixed with a single - , and yet the letters that follow it are not also interpreted as options. -p选项以-开头,但是其后的字母也不被解释为选项。 They're interpreted as the password. 它们被解释为密码。

If you want to make your usage more clear, stop using short options. 如果您想使用法更清楚,请停止使用简短选项。 Use only long option format: 仅使用长选项格式:

mysqldump --user=ost-v1-11-x --password=xWt1z0*8 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM