php如何刪除數(shù)據(jù)庫(kù)
1、首先查看有哪些數(shù)據(jù)庫(kù)
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ù)庫(kù)失敗: ' . mysqli_error($conn)); } echo "數(shù)據(jù)庫(kù) test2 刪除成功n"; mysqli_close($conn); ?>
3、運(yùn)行php程序
3、再次查看數(shù)據(jù)庫(kù)
test2沒(méi)有了,刪除成功!