Mysqldump command not clear

Hi,
I found the following code in a PHP MySQL book (Dummy Series) which is not clear to me which i quote below -

“mysqldump --user=accountname --password=password databasename>path/
backupfilename”

What I feel as error in the above code is the “–” comment operator before “user” in the above line. I think '–" indicates a comment operator in SQL/MySQL? So doesn’t the rest of the line gets discarded?
I am just trying to learn MYSQL and a novice.
And in some other books or here in the web I see this command line below-
mysqldump db -u USER -p > output_file.sql
In my class again the teacher taught this code-
mysqldump -u root -p database>file.sql ( I know this one is correct ,I am just confused with the above code)

I am confused as to which one is correct!! :confused: Are both the same?

Can you please provide me the difference between the first code and the above code lines please ??
Also,what does the “–” does in the above lines mean?
And putting “–” makes the rest of the line a comment,doesn’t it?? So how does the rest of line gets executed!!! :frowning:

Please,can someone explain to me clearly the difference between putting a “–” and “-”?
What does the “–” & “-” operators means in mysqldump??
Hope you all get me :stuck_out_tongue:

Regards

hi ravi33,

you need to run ‘mysqldump’ from the shell / windows command line, not the mysql client cli.

e.g.

  1. go to windows -> start -> run -> cmd
  2. a ‘dos’ command prompt should appear.
  3. now you can try the mysqldump command.

Hello jurn,
You totally skipped my question.
Your answer is not related to my question in any way!! :mad:
I asked the meaning of the “–” operators & what is teh meaning of the command line!!
Not how to run the mysqldump command!! :rofl:

hi ravi33 :wink:

Sorry about that, if you type in following command:

mysqldump --help

you should see a full description of its usage.

in general, on unix based command line programs, for each option,
-<single letter> is the short form
–<long-option-description> is the long form for a particular option.

Jurn

Thanks , now somewhat clear!! :slight_smile: