自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

根據(jù)Mysql表備份

數(shù)據(jù)庫 MySQL
Mysql數(shù)據(jù)庫的備份方法是每一個DBA都應(yīng)該掌握的,下面為您介紹的備份方法是根據(jù)表進(jìn)行備份的,如果您感興趣的話,不妨一看。

Mysql數(shù)據(jù)庫有多種的備份方法,下面為您介紹的方法是根據(jù)Mysql表備份,該方法供您參考,希望對您學(xué)習(xí)Mysql表備份數(shù)據(jù)庫方面能有所幫助。

  1. <?php 
  2. function datatosql($table)       
  3. {      
  4.     global $db;      
  5.     $tabledump = "DROP TABLE IF EXISTS $table;\n";      
  6.     $createtable = $db->query("SHOW CREATE TABLE $table");      
  7.     $create = $db->fetch_array($createtable);      
  8.     $tabledump .= $create[1].";\n\n";      
  9.      
  10.     $rows = $db->query("SELECT * FROM $table");      
  11.     $numfields = $db->num_fields($rows);      
  12.     $numrows = $db->num_rows($rows);      
  13.     while ($row = $db->fetch_array($rows)){      
  14.         $comma = "";      
  15.         $tabledump ."INSERT INTO $table VALUES(";      
  16.         for($i = 0; $i < $numfields; $i++)       
  17.         {      
  18.         $tabledump .= $comma."'".mysql_escape_string($row[$i])."'";      
  19.         $comma = ",";      
  20.         }      
  21.         $tabledump .");\n";      
  22.     }      
  23.     $tabledump ."\n";      
  24.      
  25.     return $tabledump;      
  26. }     
  27. ?> 

 

 

 

【編輯推薦】

MySQL Show語句用法介紹

七種Mysql表類型

MySQL聯(lián)結(jié)查詢一覽

MySQL隨機(jī)查詢的優(yōu)化實(shí)例

MySQL排序使用情況

責(zé)任編輯:段燃 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-05-31 16:10:30

MySQL備份

2019-12-13 10:31:45

數(shù)據(jù)庫SQLMySQL

2010-11-23 16:21:07

MySQL大表備份

2011-04-07 17:21:38

mysqlhotcop備份MySQL

2017-07-07 10:40:24

MySQL備份原理

2017-07-10 16:00:47

Mysql數(shù)據(jù)備份數(shù)據(jù)還原

2011-10-17 16:11:00

MySQL

2011-03-23 17:21:42

2011-03-28 16:12:55

mysql自動遠(yuǎn)程備份

2010-11-03 14:57:44

DB2備份所有表

2010-09-01 11:17:29

DB2備份

2022-05-30 11:21:25

數(shù)據(jù)庫MySQL工具

2015-03-18 13:39:35

MySQLBackup數(shù)據(jù)庫備份種類

2009-02-18 08:42:40

手動備份注冊表

2011-08-04 17:04:42

2017-07-10 14:26:03

Mysql數(shù)據(jù)備份數(shù)據(jù)恢復(fù)

2017-11-13 13:33:09

MySQL全備份恢復(fù)表

2011-08-04 18:27:55

注冊表

2009-12-15 14:36:24

2022-11-01 17:17:31

MySQL備份表
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號