SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation 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!! 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!!??!!

    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

    Regards

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    London
    Posts
    163
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs down

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

  4. #4
    SitePoint Zealot
    Join Date
    Apr 2005
    Location
    London
    Posts
    163
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi ravi33

    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

  5. #5
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks , now somewhat clear!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •