Drop Database using mysqladmin
You would require extraordinary advantages to make or to erase a MySQLi data set. So expecting you approach root client, you can make any information base utilizing mysql mysqladmin twofold.
Be cautious while erasing any information base since you will lose your all the information accessible in your data set.
Here is a guide to erase a data set made in past section −
[root@host]# mysqladmin -u root -p drop TUTORIALS
Enter password:******
This will give you an admonition and it will affirm in the event that you truly need to erase this information base or not.
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
Do you really want to drop the 'TUTORIALS' database [y/N] y
Database "TUTORIALS" dropped
Drop Database using PHP Script
PHP utilizes question capacity to make or erase a MySQLi information base. This capacity takes two boundaries and profits TRUE for progress or FALSE on disappointment.
Example
Evaluate the accompanying guide to erase an information base −
<html>
<head>
<title>Connecting MySQLi Server>/title>
</head>
<body>
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '<Password Here>';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(! $conn ){
echo 'Connected failure<br>';
}
echo 'Connected successfully<br>';
$sql = "DROP DATABASE TUTORIALS";
if (mysqli_query($conn, $sql)) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . mysqli_error($conn);
}
mysqli_close($conn);
?>
</body>
</html>
WARNING − While erasing an information base utilizing PHP content, it doesn't fast you for any affirmation. So be cautious while erasing a MySQLi data set.
Whenever associated and erased information base successfully,then the example yield ought to be this way −
Connected successfully
Database deleted successfully