[root@kvm3 html]# mysqladmin -uroot -p123qwe drop dyw 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 'dyw' database [y/N] y Database "dyw" dropped
[root@kvm3 html]# vi dropdb.php
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '123qwe';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass)
or die(mysqli_connect_error().PHP_EOL);
echo 'Connected successfully'.PHP_EOL;
$sql = 'DROP DATABASE dywphp';
mysqli_query( $conn, $sql )
or die('Error: '.mysqli_error($conn).PHP_EOL);
echo "Database dywphp deleted successfully\n";
mysqli_close($conn);
?>
[root@kvm3 html]# curl http://kvm3/dropdb.php Connected successfully Database dywphp deleted successfully
[root@kvm3 html]# curl http://kvm3/dropdb.php Connected successfully Error: Can't drop database 'dywphp'; database doesn't exist
[root@kvm3 html]# mariadb -uroot -p123qwe -e "show databases" +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+