Create Database using mysqladmin
You would require unique advantages to make or to erase a MySQLi information base. So accepting you approach root client, you can make any information base utilizing mysql mysqladmin paired.
Example
Here is a basic guide to make data set called TUTORIALS −
[root@host]# mysqladmin -u root -p create TUTORIALS
Enter password:******
This will make a MySQLi information base TUTORIALS.
Create Database using PHP Script
PHP utilizes mysqli_query capacity to make or erase a MySQLi information base. This capacity takes two boundaries and profits TRUE for progress or FALSE on disappointment.
Example
Evaluate the accompanying guide to make a data set −
<html>
<head>
<title>Connecting MySQLi Server</title>
</head>
<body>
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '<password here>';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(! $conn ){
echo 'Connected failure<br>';
}
echo 'Connected successfully<br>';
$sql = "CREATE DATABASE TUTORIALS";
if (mysqli_query($conn, $sql)) {
echo "Database created successfully";
} else {
echo "Error creating database: " . mysqli_error($conn);
}
mysqli_close($conn);
?>
</body>
</html>
Whenever associated and made data set successfully,then the example yield ought to be this way −
Connected successfully
Database created successfully