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, 2862🔥, 0💬
Popular Posts:
How To Convert Binary Strings into Integers in SQL Server Transact-SQL? Binary strings and integers ...
How To Start MySQL Server in MySQL? If you want to start the MySQL server, you can run the "mysqld" ...
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login name...
How To Create a Stored Program Unit in Oracle? If you want to create a stored program unit, you can ...
How to format a number of bytes in a human-readable unit using the FORMAT_BYTES() function? FORMAT_B...