Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Using curl to download a db dump?

Help
2012-04-10
2013-06-06
  • How would I use curl to download a dump of a specific db? I tried mimicking the exact headers and data that get sent when I use adminer through the browser but it's not working. Any ideas? This is what I'm currently using:

    curl -s -S -d "driver=server" -d "server=localhost" -d "username=$USER" -d "password=$PASSWORD" -d "databases%5B%5D=$DB"     -d "format=sql" -d "output=text" -d "data_style=INSERT" -d "triggers=1" -d "auto_increment=1" -d "table_style=DROP%2BCREATE" -d "events=1" -d "routines=1" -d "db_style=CREATE" "http://$HOST/adminer.php?server=localhost&username=$USER&dump="
    
     
  • Jakub Vrána
    Jakub Vrána
    2012-05-14

    If the server requires a password then you need to pass a session ID in URL parameter or cookie. You can use CURL to emulate sending the login form.

    Also, better specification than "it's not working" is always useful.

     
  • Hi, I'm having pretty much the same problem. I am using a very similar curl command and it is only giving me the login page. This seems to work on some servers/sites but not others. Is there any info I could give to help debug this? My curl command is below:

    curl -d "server=localhost&username=some_user&password=password&databases=db_name&format=sql&output=text&data_style=insert&triggers=1&auto_increment=1&table_style=DROP%2BCREATE&events=1&routines=1&db_style=CREATE%2BALTER" http://somesite.com/adminer.php?server=localhost&username=some_user&db=db_name&dump=