Mysql Delete Database Drop db
Method-: Download Delete using cmd mode
mysql> drop Database School;
This name deletes the school database. However, an error occurs if the school database does not exist. So the complete statement should write this:
Mysql> drop database if exists school;
Method Two: PHP script delete Database
In PHP, we can use the Mysql_query function to execute the SQL statement. So when we delete the database, we can use the mysql_query to execute the delete command directly.
<?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);
? >
Thank you for reading, I hope to help you, thank you for your support for this site!