<tr bgcolor="#F3F3F3">
<td width="166" align="right"> 数据库名:</td>
<td width="313"><input name="database" type="text" class="borderoff" value="yes_da" size="35" maxlength="50">
</td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="166" align="right">账 号:</td>
<td width="313"><input name="username" type="text" class="borderoff" value="root" size="35" maxlength="50">
</td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="166" align="right">密 码:</td>
<td width="313"><input name="password" type="text" class="borderoff" size="35" maxlength="50">
</td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="166" align="right"> 完全备份:</td>
<td width="313">
<input type="radio" name="backup_type" value="full" checked>
</td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="166" align="right">只备份结构:</td>
<td width="313">
<input type="radio" name="backup_type" value="structure">
</td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="166" align="right">只备份数据:</td>
<td width="313">
<input type="radio" name="backup_type" value="data">
</td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="166" align="right">采用压缩格式:</td>
<td width="313">
<input type="radio" name="gzipcompress" value="0" checked>
否
<input type="radio" name="gzipcompress" value="1">
是(zip)</td>
</tr>
<tr>
<td colspan="2" align="center">
<input name="backupstart" type="submit" value="开始备份">
</td>
</tr>
</table>
</form>
<p align="center"> <br>
<br>
</p></td>
</tr>
</table>
</body>
</html>
cmd.php
<?php
if(isset($_POST[''backupstart'']))
{
$hostname = trim($_POST[''hostname'']);
$database = trim($_POST[''database'']);
$username = trim($_POST[''username'']);
$password = trim($_POST[''password'']);
$backtype = $_POST[''backup_type''];
$gz = $_POST[''gzipcompress''];
$link = @mysql_pconnect($hostname, $username, $password);
if(!$link)
{ //连接数据库
echo "数据库打开出错!";
exit();
}//end if
$table_list = get_table_list($link,$database);
if($table_name===false)
{ //检索数据库的表
echo "数据库打开出错!!";
exit();
}//end if
//echo "<pre>";
//print_r($table_list);
关于如何备份数据库(Mysql)的简易程序
0
相关文章