久久久久久久性爱潮,国产又粗又猛又爽又黄下载视频,尤物国产在线一区视频,欧美日本国产在线不卡

<sup id="4uqqy"><ol id="4uqqy"></ol></sup>
  • <th id="4uqqy"></th>

      • <strike id="4uqqy"><nobr id="4uqqy"><ins id="4uqqy"></ins></nobr></strike><sup id="4uqqy"></sup><strong id="4uqqy"><u id="4uqqy"></u></strong>
        <sub id="4uqqy"></sub>

          綠色資源網(wǎng):您身邊最放心的安全下載站! 最新軟件|熱門排行|軟件分類|軟件專題|廠商大全

          綠色資源網(wǎng)

          技術(shù)教程
          您的位置:首頁數(shù)據(jù)庫類MySQL → 如何導(dǎo)出mysql數(shù)據(jù)庫到sql文件

          如何導(dǎo)出mysql數(shù)據(jù)庫到sql文件

          我要評論 2012/04/24 14:11:42 來源:綠色資源網(wǎng) 編輯:downcc.com [ ] 評論:0 點(diǎn)擊:696次

          你的用戶可能會要求你增加一個(gè)導(dǎo)出整個(gè)數(shù)據(jù)庫到sql文件的一個(gè)選項(xiàng),當(dāng)然phpMyAdmin或者Navicat可以做到這些,但是您的用戶可能想要更簡單的方法。

          創(chuàng)建一個(gè)名為backup.php的新文件,復(fù)制粘貼以下代碼。如果需要的話,編輯數(shù)據(jù)庫連接設(shè)置和mysqldump路徑。為你的應(yīng)用添加一個(gè)backup.php的超級連接。

          <a href="back.php">export the whole database</a>

          請注意:為了保存和壓縮轉(zhuǎn)儲文件,該腳本需要一個(gè)可寫權(quán)限。如果你的腳本沒有可寫權(quán)限請使用第二個(gè)版本,唯一的缺點(diǎn)是無法壓縮轉(zhuǎn)儲文件。

          有壓縮版本需要可寫權(quán)限:

          <?php
           
          $username = "root"; 
          $password = ""; 
          $hostname = "localhost"; 
          $dbname   = "cars";
           
          // if mysqldump is on the system path you do not need to specify the full path
          // simply use "mysqldump --add-drop-table ..." in this case
          $dumpfname = $dbname . "_" . date("Y-m-d_H-i-s").".sql";
          $command = "C:\\xampp\\mysql\\bin\\mysqldump --add-drop-table --host=$hostname
              --user=$username ";
          if ($password) 
                  $command.= "--password=". $password ." "; 
          $command.= $dbname;
          $command.= " > " . $dumpfname;
          system($command);
           
          // zip the dump file
          $zipfname = $dbname . "_" . date("Y-m-d_H-i-s").".zip";
          $zip = new ZipArchive();
          if($zip->open($zipfname,ZIPARCHIVE::CREATE)) 
          {
             $zip->addFile($dumpfname,$dumpfname);
             $zip->close();
          }
           
          // read zip file and send it to standard output
          if (file_exists($zipfname)) {
              header('Content-Description: File Transfer');
              header('Content-Type: application/octet-stream');
              header('Content-Disposition: attachment; filename='.basename($zipfname));
              flush();
              readfile($zipfname);
              exit;
          }
          ?>

          沒有壓縮,不需要可寫權(quán)限:

          <?php
          ob_start();
           
          $username = "root"; 
          $password = ""; 
          $hostname = "localhost"; 
          $dbname   = "cars";
           
          // if mysqldump is on the system path you do not need to specify the full path
          // simply use "mysqldump --add-drop-table ..." in this case
          $command = "C:\\xampp\\mysql\\bin\\mysqldump --add-drop-table --host=$hostname
              --user=$username ";
          if ($password) 
                  $command.= "--password=". $password ." "; 
          $command.= $dbname;
          system($command);
           
          $dump = ob_get_contents(); 
          ob_end_clean();
           
          // send dump file to the output
          header('Content-Description: File Transfer');
          header('Content-Type: application/octet-stream');
          header('Content-Disposition: attachment; filename='.basename($dbname . "_" . 
              date("Y-m-d_H-i-s").".sql"));
          flush();
          echo $dump;
          exit();]]>
          ?>

          原文地址:http://webcheatsheet.com/php/how_to_create_a_dump_of_mysql_database_in_one_click.php

          關(guān)鍵詞:mysql數(shù)據(jù)庫

          閱讀本文后您有什么感想? 已有 人給出評價(jià)!

          • 1 歡迎喜歡
          • 1 白癡
          • 1 拜托
          • 1 哇
          • 1 加油
          • 1 鄙視