Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Use Adminer only for DB export?

Help
2010-01-04
2014-03-12
  • Is ist possible to customize adminer just to export a DB without any screen output before? (With adminer_object and pre filled GET and POST values maybe?)

     
  • Jakub Vrána
    Jakub Vrána
    2010-01-04

    Yes, you can achieve this by a simple script:

    $_GET = array(
    "username" => "",
    "dump" => "",
    );
    $_POST = array(
    "format" => "sql",
    "table_style" => "CREATE",
    "data_style" => "INSERT",
    "databases" => array("cds"),
    );

    function adminer_object() {
    class AdminerLogin extends Adminer {
    function credentials() {
    return array("localhost", "ODBC", "pass");
    }
    }
    return new AdminerLogin;
    }

    include "./adminer.php";

     
  • Perfect - thank you!

     
  • Hi… I'm trying to catch dump output to variable but it seems to be not working. Here is the code I use:

        ob_start();
        $_GET = array(
            "username"    => "username",
            "dump"        => ""
        );
    
        $_POST = array(
            "output"      => "text",
            "format"      => "sql",
            "table_style" => "CREATE",
            "data_style"  => "INSERT",
            "databases"   => array("database")
        );
        function adminer_object() {
            class AdminerLogin extends Adminer {
                function credentials() {
                    return array("server", "user", "password");
                }
            }
    
            return new AdminerLogin;
        }
        include './adminer.php';
        $content = ob_get_contents();
        ob_end_flush();
        echo $content;
    
     
  • Jakub Vrána
    Jakub Vrána
    2012-02-03

    Works for me.

     
  • Hi,
    If I am dumping a db to a file and have the POST array value for "output" as "file" can I provide the filename? How?

    Thanks! Jim

     
  • Hi,
    when I use the code above, I am still getting Maximum number of allowed fields exceeded. Please increase max_input_vars. error. Increasing max_input_vars has no effect.

    I see this thread is about an year old, so maybe something has changed in Adminer. What could be wrong?

    Thanks!
    Martin

    (PHP 5.4.12 on Apache 2.4.4, MySQL 5.6.12)

     
  • Jakub Vrána
    Jakub Vrána
    2013-07-16

    You also need to set $_POST["token"] = $_SESSION["token"]. A good place to do this is inside the login() method.

     
  • Jakub Vrána
    Jakub Vrána
    2013-12-21

    You can use this script to export data using Adminer: https://gist.github.com/vrana/8072771

    You would need Adminer source codes to use it.

     
    • Stef
      Stef
      2014-03-10

      Hi,
      Starting from your Adminer concept - all in one file - I need to upload a file on the customer server, that backups the database periodically in a file. So, my question is: it is posible to have the script - https://gist.github.com/vrana/8072771 - functionality using the compiled Adminer?
      Thanks

       
      • Jakub Vrána
        Jakub Vrána
        2014-03-11

        No, that would be harder.

         
        • Stef
          Stef
          2014-03-12

          ok,
          thanks