mysqldatabasecommand-linedatabase-scripts

how to get DB backup script from Remote Server in MySQL using command-line utility?


Can anybody tell me that how to get DB backup script from Remote Server in MySQL using command-line utility?

I'm using a command as follows, but not working:

C:\>mysqldump -h <server ip> -u <user-id> -p <password> <db name> >
 E:\dumpfilename.sql

Solution

  • The syntax for the password is wrong. You need to write the password immediately after the -p, without a space. That's why the password is interpreted as the database name.

    Write this instead:

    C:\>mysqldump -h <server ip> -u <user-id> -p<password> <db name> >
     E:\dumpfilename.sql
    

    Notice how there is no space after -p. An example would be -phunter2, where the password is "hunter2".