The command to delete a database is: "DROP DATABASE database name;"; for example, "drop database student;" is to delete the database named student. The "DROP DATABASE" statement can be used to delete a database.

Use the drop command to delete the database
drop database# The ## statement can be used to delete the database.
drop database <数据库名>;For example, to delete the database named student:
mysql> drop database student;
Expand knowledge
Use PHP script to delete database
PHP uses the mysqli_query function to create or delete a MySQL database. This function has two parameters and returns TRUE when executed successfully, otherwise it returns FALSE. Grammarmysqli_query(connection,query,resultmode);

<?php
$dbhost = 'localhost'; // mysql服务器主机地址
$dbuser = 'root'; // mysql用户名
$dbpass = '123456'; // mysql用户名密码
$conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('连接失败: ' . mysqli_error($conn));
}
echo '连接成功<br />';
$sql = 'DROP DATABASE student';
$retval = mysqli_query( $conn, $sql );
if(! $retval )
{
die('删除数据库失败: ' . mysqli_error($conn));
}
echo "数据库 RUNOOB 删除成功\n";
mysqli_close($conn);
?>Related recommendations: "PHP Tutorial》、《mysql tutorial》
The above is the detailed content of What is the command to delete a database in MySQL?. For more information, please follow other related articles on the PHP Chinese website!