Collections:
Deleting an Existing Database in MySQL
How To Drop an Existing Database in MySQL?
✍: FYIcenter.com
If want to drop an existing database from the MySQL server, you can use the DROP DATABASE statement. Here is a good example of dropping an existing database:
$con = mysql_connect('localhost:8888', 'dev', 'iyf');
$sql = 'DROP DATABASE fyi';
if (mysql_query($sql, $con)) {
print("Database fyi dropped.\n");
} else {
print("Database drop failed with error:\n");
print(mysql_errno($con).": ".mysql_error($con)."\n");
}
mysql_close($con);
?>
If you run this script, you will get something like this, if "dev" does not have privilege to drop database:
Database drop failed with error: 1044: Access denied for user 'dev'@'%' to database 'fyi'
⇒ Selecting an Existing Database in MySQL
⇐ Retrieving Execution Error Message in MySQL
2017-10-23, 2934🔥, 0💬
Popular Posts:
How To Download Oracle Database 10g XE in Oracle? If you want to download a copy of Oracle Database ...
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...
What Are the Differences between DATE and TIMESTAMP in Oracle? The main differences between DATE and...
What Is Transport Network Substrate (TNS) in Oracle? TNS, Transport Network Substrate, is a foundati...