Create database of MySQL through PHP

In this article I am going to explain about database creation in MySQL.
  • 1986

PHP MySQL create database

Database is a collection of tables and which is easily accessed , managed and update.

Creating a database

The CREATE DATABASE statement is used for creating a database in MySQL.

Syntax of creating a database

create database databaseName

Example of creating a database in MySQL




$con = mysql_connect("localhost","gupta","sharad");

if (!$con)


  die('Could not connect: ' . mysql_error());



if (mysql_query("CREATE DATABASE Mcn_Solution",$con))


  echo "Database created";




  echo "Error creating database: " . mysql_error();








You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.