ivan
ivan

Reputation: 1

mysqldump always returns "option '--tables' cannot take an argument"

I am trying to backup a mysql database using mysqldump command, but the message I get is mysqldump: option '--tables' cannot take an argument.

Here you are:

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

I have tryed several argument combinations, but I finally discovered that the result is the same if I just try to get the command version or event with no arguments at all:

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

As you can see in the following lines, it is mysql server 5.5 running on debian 7.

System version:

root@myhost:~# uname -a
Linux myhost 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux

mysql client version:

root@myhost:~# mysql --version
mysql  Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.2

mysql server version:

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

I have looked for this problem on the web, but I cannot see anyone reporting this precise issue. I am not an expert on mysql but I can say it is a very simple install. Should you need more information, please tell me.

Thanks in advance, ivan

Upvotes: 0

Views: 3328

Answers (2)

ivan
ivan

Reputation: 1

Following @DCoder indications I inspected /etc/mysql/my.cnf which, among others, contained

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock
table          = true

After removing table = true line from /etc/mysql/my.cnf, mysqldump command works as expected:

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

My conclusion is that table=true option is not suitable for mysqldump command and must be removed from [client] in the options file. [client] section groups option settings applied to all client programs.

Should another command need that option set, it should be placed in another program section, neither in [mysqldump] nor in [client].

Upvotes: 0

Ansh
Ansh

Reputation: 94

Try this

mysqldump --tab = dir_name options db_name tbl_name

--tab writes each dumped file as a tab-delimited text file in the "dir_name" directory.

db_name is the db containing the table to the exported.

tbl_name is the table to be exported.

"options" part may include options such as --host or --user.

e.g.

mysqldump --tab = /tmp office contact

Upvotes: 0

Related Questions