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, 2532🔥, 0💬
Popular Posts:
How To Format DATETIME Values to Strings with the CONVERT() Function in SQL Server Transact-SQL? SQL...
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...
Can You Drop an Index Associated with a Unique or Primary Key Constraint in Oracle? You can not dele...
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, y...
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...