我正试图使用mysqldump命令备份mysql数据库,但收到的消息是:选项"--tables"不能带有参数。
给你:
root@myhost:~# mysqldump mydatabase --user myuser --password mypassword
Warning: Using unique option prefix table instead of tables is deprecated and will be removed in a future release. Please use the full name instead.
mysqldump: option '--tables' cannot take an argument
我尝试了几种参数组合,但我最终发现,如果我只是尝试获得完全没有参数的命令版本或事件,结果是一样的:
root@myhost:~# mysqldump --version
Warning: Using unique option prefix table instead of tables is deprecated and will be removed in a future release. Please use the full name instead.
mysqldump: option '--tables' cannot take an argument
root@myhost:~# mysqldump
Warning: Using unique option prefix table instead of tables is deprecated and will be removed in a future release. Please use the full name instead.
mysqldump: option '--tables' cannot take an argument
正如您在下面几行中看到的,它是运行在debian7上的mysqlserver5.5。
系统版本:
root@myhost:~# uname -a
Linux myhost 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux
mysql客户端版本:
root@myhost:~# mysql --version
mysql Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.2
mysql服务器版本:
root@myhost:~# mysql -h localhost --user=myuser --password=mypassword mydatabase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 75
Server version: 5.5.35-0+wheezy1-log (Debian)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> quit
Bye
我在网上找过这个问题,但我看不到有人报道这个确切的问题。我不是mysql的专家,但我可以说这是一个非常简单的安装。如果你需要更多信息,请告诉我。
提前感谢,ivan
根据@DCoder指示,我检查了/etc/mysql/my.cnf
,其中包括
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
table = true
从/etc/mysql/my.cnf
中删除table=true行后,mysqldump命令按预期工作:
root@myhost:~# mysqldump
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
我的结论是table=true
选项不适合mysqldump命令,必须从选项文件中的[client]
中删除。[client]
部分将应用于所有客户端程序的选项设置分组。
如果另一个命令需要该选项集,则应将其放置在另一个程序节中,既不在[mysqldump]
中,也不在[client]
中。
试试这个
mysqldump --tab = dir_name options db_name tbl_name
--tab将每个转储的文件作为tab分隔的文本文件写入"dir_name"目录。
db_name是包含要导出的表的数据库。
tbl_name是要导出的表。
"选项"部分可能包括诸如--host或--user之类的选项。
例如
mysqldump --tab = /tmp office contact