MySQL Create Database | PHP MySQL
×

MySQL Create Database

3970

A database is the container of tables. For creating a MYSQL Database firstly, we need to make connection with the server.

The statement used for database creation is 'CREATE DATABASE'

<?php

$servername="localhost";
$username="user";
$password="pass";

//Create connection
$connect=mysql_connect($servername,$username,$password); or die("Connection failed");

//After connecting to mysql, create Database
$db="CREATE DATABASE user";

if(mysql_query($connect,$db))
{
echo "Database Successfully Created";
}
else
{
echo "Database Creation Failed";
}

?

To check your database, go to localhost panel:

http://localhost/phpmyadmin



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments