php如何刪除數(shù)據(jù)庫
1、首先查看有哪些數(shù)據(jù)庫
2、使用php刪除test2
<?php $dbhost = 'localhost'; // mysql服務(wù)器主機(jī)地址 $dbuser = 'root'; // mysql用戶名 $dbpass = 'root'; // mysql用戶名密碼 $conn = mysqli_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('連接失敗: ' . mysqli_error($conn)); } $sql = 'DROP DATABASE test2'; $retval = mysqli_query( $conn, $sql ); if(! $retval ) { die('刪除數(shù)據(jù)庫失敗: ' . mysqli_error($conn)); } echo "數(shù)據(jù)庫 test2 刪除成功\n"; mysqli_close($conn); ?>
3、運(yùn)行php程序
3、再次查看數(shù)據(jù)庫
test2沒有了,刪除成功!
更多PHP相關(guān)知識,請?jiān)L問PHP中文網(wǎng)!
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com