SN Palita
SN Palita

Reputation: 117

How to use mysqldump only specific database and table in MYSQL

I have an issue when specific database and table using mysqldump.

First in IP Server (111.111.1.1 Fake server) There are 3 databases which are DBname1,DBname2 and DBname3

I need to dump the table mm_cash which in DBname2

The query that I use:

mysqldump --host=111.111.1.1 --user=fakeuser --password=fakepas --databases=DBname2 --tables=mm_cash --where="true limit 1" > D:\test.txt

However, I got this error:

mysqldump: [Warning] Using a password on the command line interface cenbe insecure. mysqldump: [Warning] mysqldump: ignoring option '--databases' due to invalid value 'DBname2' mysqldump: [Error] mysqldump: option '--tables' cannot take an argument

For 2nd error,I have already checked this is an correct database name. Could anyone please help?

Upvotes: 6

Views: 16920

Answers (2)

WMRamadan
WMRamadan

Reputation: 1210

Try this...

mysqldump -u fakeuser -p DBname2 mm_cash > DBname2_mm_cash.sql

Upvotes: 4

Gianluca Mereu
Gianluca Mereu

Reputation: 326

The problem is the way you are using the options --databases and --tables. In reality you shouldn't use them but you have to put the database name and the table at the end of the command as specified in the help :

Usage: mysqldump [OPTIONS] database [tables]

Try this:

mysqldump --host=111.111.1.1 --user=fakeuser --password=fakepas --where="true limit 1" DBname2 mm_cash  > D:\test.txt

Upvotes: 6

Related Questions