Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Drop an Existing Database
How To Drop an Existing Database? - MySQL FAQs - PHP Connections and Query Execution
✍: 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'
2007-05-10, 4966👍, 0💬
Popular Posts:
How To Write a Minimum Atom 1.0 Feed File? - RSS FAQs - Atom Feed Introduction and File Generation I...
Describe in detail Basic of SAO architecture of Remoting? For these types of questions interviewer e...
Can one change the mouse pointer in Forms? The SET_APPLICATION_PROPERTY build-in in Oracle Forms all...
How To Return Top 5 Rows? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries If you want ...
What is the main difference between a Vector and an ArrayList? Java Vector class is internally synch...