MySQLi Drop Database

The DROP DATABASE statement is used to delete a database in MySQL.

Below the example to drop a database:

<?php
   $conn  = mysqli_connect('localhost:3306', 'user_name', 'password', 'db_nexladder');
   if(! $conn) {
       die('Could not connect: ' . mysqli_error());
   }
   $sql = "DROP DATABASE `db_nexladder`";
   if (mysqli_query($conn, $sql)) { 
     echo "Database deleted Successfully";
   } else { 
     echo "Error:". mysqli_error($conn); 
   }
   mysqli_close($conn);
 ?>

Output: Database deleted Successfully