Create Database using MySqladmin

0
188

You can create any database using MySQL mysqladmin binary.Either it is a local server made by using Xamp or Online servers.This way you can have a database ready.

Example:

A simple example to Show you as how to  create database named as “Database tutorials”:

[[email protected]]# mysqladmin -u root -p create Database tutorials

Enter password:*****

The above-given code will create a MySQL database  “Database Tutorials”.

 

Create Database using PHP Script:

PHP uses the mysql_query function in order create or delete a MySQL database.

Syntax:

bool mysql_query( SQL, connection );

Commands Details
sql Required – SQL query in order to create or delete a MySQL database
connection “Optional” – if it is not specified, then last opened connection which a user used by mysql_connect will be used in the current one.

Example:

Creating a database:

 
[php]

Creating your own MySQL Database


‘;
$mysql = ‘CREATE YOUR OWN DATABASE TUTORIALS’;
$Result = mysql_query( $sql, $con );
if(! $result )
{
die(‘Could not create database due to error: ‘ . mysql_error());
}
echo “Database TUTORIALS created successfully without any error\n”;
mysql_close($conn);
?>

[/php]
Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.