Collections:
Failed to Create a Database in MySQL
What Happens If You Do Not Have Privileges to Create Database in MySQL?
✍: FYIcenter.com
If your MySQL server is provided by your Internet service company, your user account will most likely have no privilege to create new databases on the server. In that case, your CREATE DATABASE statement will fail. Here is an example of using a less privileged user account to create a new database:
<?php
$con = mysql_connect('localhost:8888', 'guest', 'pub');
$sql = 'CREATE DATABASE fyicenter';
if (mysql_query($sql, $con)) {
print("Database fyi created.\n");
} else {
print("Database creation failed.\n");
}
mysql_close($con);
?>
If you run this script, you will get something like this:
Database creation failed.
⇒ Retrieving Execution Error Message in MySQL
⇐ Creating a New Database in MySQL
2017-11-11, 2227🔥, 0💬
Popular Posts:
How To Install Oracle Database 10g XE in Oracle? To install 10g universal edition, double click, Ora...
How To Connect ASP Pages to Oracle Servers in Oracle? If you are running Windows IIS Web server and ...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
How to execute statements in loops in SQL Server Transact-SQL? How to use WHILE ... loops? You can u...
Where to find answers to frequently asked questions on INSERT, UPDATE and DELETE Statements in MySQL...