How to delete MySQL Database using PHP

There is another method to delete database which one is not needed to any project or project is not able to execute. using php script for deleting database connection should be done and make sure the connected database not using because it’ll delete database permanently.

$servername = "localhost";
$username = "root";
$password = "";

try {
    $conn = new PDO("mysql:host=$servername;dbname=reg_record", $username, $password);
    // set the PDO error mode to exception
   $querry = $conn->prepare('DROP DATABASE reg_record');
catch(PDOException $e)
    echo "Connection failed: " . $e->getMessage();

3 Replies to “How to delete MySQL Database using PHP”

  1. I and also my buddies ended up reviewing the nice secrets and techniques on the blog and quickly developed a terrible feeling I never expressed respect to the blog owner for those techniques. The people happened to be so thrilled to learn them and have in effect in fact been tapping into those things. We appreciate you truly being simply thoughtful as well as for making a decision on variety of nice subjects millions of individuals are really needing to understand about. Our sincere apologies for not saying thanks to sooner.

Leave a Reply

Your email address will not be published. Required fields are marked *