MySQL backup w/o dump?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oliver Spiesshofer

    MySQL backup w/o dump?

    Hi,

    is there some free script that exports a whole database to a file similar
    to mysqldump but without using mysqldump?
    It should not be embedded too deeply into an application since I want to
    include it into another open-source project without having to disassemble a
    major other script such as phpMyAdmin.

    thanks

    Oliver

  • Michael Vilain

    #2
    Re: MySQL backup w/o dump?

    In article <Xns959C915908E F4oliveremailco m@63.223.5.254> ,
    Oliver Spiesshofer <oliver@email.c om> wrote:
    [color=blue]
    > is there some free script that exports a whole database to a file similar
    > to mysqldump but without using mysqldump?
    > It should not be embedded too deeply into an application since I want to
    > include it into another open-source project without having to disassemble a
    > major other script such as phpMyAdmin.[/color]

    Don't see how you can do this with "it should not be embedded to deeply
    into an application". The script, which you'll probably have to write
    custom, must know of your tables and databases, extract the data
    definition and the data itself, and write all this to a file. You're
    essentially duplicating the effort of mysqldump.

    Unless you can write such a script yourself, mysqldump is probably your
    best bet. Why re-invent the wheel, unless you've got lots of time on
    your hands?

    cheap, fast, on-time. pick 2.

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...



    Comment

    • Eric Brongers

      #3
      Re: MySQL backup w/o dump?

      Hi Oliver,

      I use the folowing in a script:

      Note: $ADMIN is the connection class to the MySQL database. I Build my own
      CMS_class witch uses Pear to connect to a database. But I guess you
      can read between the lines and use all the usefull stuff

      Regards,
      Eric
      Freelance PHP Programmer.


      function makedumpfile($t able,$exkey="") {
      global $ADMIN;
      $query="select * from ".$table;
      $result=$ADMIN->query($query );

      if (is_file("../temp/".$table.".sql" )) unlink ("../temp/".$table.".sql" );

      $fp=fopen("../temp/".$table.".sql" ,"w");

      fwrite($fp,"DEL ETE FROM ".$table."\r\n" );
      while ($Record=$resul t->fetchRow(DB_FE TCHMODE_ASSOC)) {
      //print_r($Record );
      $velden="";
      $waarden="";
      foreach ($Record as $key=>$waarde) {
      if ($exkey!=$key) {
      $velden.=$key." ,";
      $waarden.="'".$ waarde."',";
      }
      }
      //for($j=0; $j<$localdb->numCols($resul t);$j++)
      //$table_list .= mysql_field_nam e($result,$j)." , ";
      $velden=substr( $velden,0,-1);
      $waarden=substr ($waarden,0,-1);
      $dumptekst="INS ERT INTO ".$table." (".$velden." ) VALUES
      (".str_replace( "\r\n","",$waar den).")";
      $dumptekst.="\r \n";
      fwrite($fp,$dum ptekst);
      }
      fclose($fp);


      }


      "Oliver Spiesshofer" <oliver@email.c om> schreef in bericht
      news:Xns959C915 908EF4oliverema ilcom@63.223.5. 254...[color=blue]
      > Hi,
      >
      > is there some free script that exports a whole database to a file similar
      > to mysqldump but without using mysqldump?
      > It should not be embedded too deeply into an application since I want to
      > include it into another open-source project without having to disassemble[/color]
      a[color=blue]
      > major other script such as phpMyAdmin.
      >
      > thanks
      >
      > Oliver
      >[/color]
      "Oliver Spiesshofer" <oliver@email.c om> schreef in bericht
      news:Xns959C915 908EF4oliverema ilcom@63.223.5. 254...[color=blue]
      > Hi,
      >
      > is there some free script that exports a whole database to a file similar
      > to mysqldump but without using mysqldump?
      > It should not be embedded too deeply into an application since I want to
      > include it into another open-source project without having to disassemble[/color]
      a[color=blue]
      > major other script such as phpMyAdmin.
      >
      > thanks
      >
      > Oliver
      >[/color]


      Comment

      • Oliver Spiesshofer

        #4
        Re: MySQL backup w/o dump?

        "Michael Vilain <vilain@spamcop .net>" wrote in
        news:vilain-DDEA35.09485209 112004@news.gig anews.com:
        [color=blue]
        > Don't see how you can do this with "it should not be embedded to
        > deeply into an application". The script, which you'll probably have
        > to write custom, must know of your tables and databases, extract the
        > data definition and the data itself, and write all this to a file.[/color]

        you misunderstood me. with "integrated " I meant that its a lot of work to
        disasemble phpMyAdmin just to get a replacement of mysqldump. I know that
        the script needs to be integrated into the software where I want to do it.
        But I am searching for something which is easier to take out from where it
        is than from phpMyAdmin.
        [color=blue]
        > You're essentially duplicating the effort of mysqldump.[/color]
        exactly. just like phpMyAdmin did.
        [color=blue]
        > Unless you can write such a script yourself, mysqldump is probably
        > your best bet. Why re-invent the wheel, unless you've got lots of
        > time on your hands?[/color]

        because this is supposed to become part of a open-source project which is
        also directed at people who do not have access to mysqldump since their
        provider does not allow it.

        Oliver

        Comment

        • Oliver Spiesshofer

          #5
          Re: MySQL backup w/o dump?

          "Eric Brongers" <ebrongers@wana doo.nl> wrote in
          news:4191c1d4$0 $25965$e4fe514c @news.xs4all.nl :
          [color=blue]
          > Hi Oliver,
          >
          > I use the folowing in a script:
          >[/color]

          thanks a lot! this is the first step.
          Now I am missing "only" the one that is listing all tables and creates them
          from scratch.

          Oliver

          Comment

          • Oliver Spiesshofer

            #6
            Re: MySQL backup w/o dump?

            Oliver Spiesshofer <oliver@email.c om> wrote in
            news:Xns959EC12 9CD0FFoliverema ilcom@63.223.5. 246:
            [color=blue]
            > Now I am missing "only" the one that is listing all tables and creates
            > them from scratch.[/color]

            finally I found exactly the package I searched for at

            Free, secure and fast downloads from the largest Open Source applications and software directory - SourceForge.net


            Oliver

            Comment

            Working...