Mysql 刪除數(shù)據(jù)庫drop database詳細介紹
Mysql 刪除數(shù)據(jù)庫drop database
方法-:使用cmd模式下載刪除
mysql> drop database school;
此命名刪除了school數(shù)據(jù)庫。但如果school數(shù)據(jù)庫不存在就會報錯。所以完整的語句應該這么寫:
mysql> drop database if exists school;
方法二:PHP腳本刪除數(shù)據(jù)庫
在php中,我們可以使用mysql_query函數(shù)來執(zhí)行sql語句。 所以刪除數(shù)據(jù)庫時,我們可以直接用mysql_query來執(zhí)行刪除命令。
<?php $dbhost = 'localhost:3036'; $dbuser = 'root'; $dbpass = 'rootpassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully<br />'; $sql = 'DROP DATABASE TUTORIALS'; $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not delete database: ' . mysql_error()); } echo "Database TUTORIALS deleted successfullyn"; mysql_close($conn); ?>
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
- Mysql字符串截取函數(shù)SUBSTRING的用法說明
- 超詳細mysql left join,right join,inner join用法分析
- MySQL日期數(shù)據(jù)類型、時間類型使用總結(jié)
- windows下MySQL5.6版本安裝及配置過程附有截圖和詳細說明
- Mysql命令行導入sql數(shù)據(jù)
- MySQL server has gone away 問題的解決方法
- MySQL創(chuàng)建用戶與授權(quán)方法
- mySQL中replace的用法
- MySQL數(shù)據(jù)庫備份與恢復方法
- MySQL提示:The server quit without updating PID file問題的解決辦法
相關(guān)文章
解析Mysql備份與恢復簡單總結(jié)與tee命令的使用介紹
本篇文章是對Mysql備份與恢復簡單總結(jié)與tee命令的使用進行了詳細的分析介紹,需要的朋友參考下2013-06-06Mysql 錯誤too many connections解決方案
這篇文章主要介紹了Mysql 錯誤too many connections解決方案的相關(guān)資料,這里提供了如何解決此問題,需要的朋友可以參考下2016-11-11