$db = new PDO('mysql:host=localhost;dbname=mydb', 'username', 'password'); $dropQuery = "DROP SCHEMA my_schema"; $stmt = $db->prepare($dropQuery); $stmt->execute();
$db = mysqli_connect("localhost", "username", "password", "mydb"); $dropQuery = "DROP SCHEMA my_schema"; mysqli_query($db, $dropQuery);In this example, we are using the mysqli library to connect to a database called "mydb" and drop a schema called "my_schema". The drop query is executed using the mysqli_query() function. Package library: Both PDO and mysqli libraries can be used to drop a database schema in PHP.