如何从sql查询创建mysql数据库

I need to create a database from MySQL query. I have used the following, but it is not working.

$sql2 = "CREATE DATABASE DATABAE_NAME";
$query2=mysqli_query($connect_dude,$sql2);

This query is not creating any database. Probably,I have to use database username and password, but I'm not quite sure how to apply or use database username, password and host in this case.

Here is a sample php code about connecting DB Hope this will help.

<?php

//mysqli query for connecting database  
//mysqli_connect('host','username','password')
$connection=mysqli_connect('localhost','root','');
if($connection)
{
    //saving query for creating database in a variable 
    $query="CREATE DATABASE student";

    //creating Database
    $newdb=mysqli_query($connection,$query);

    //testing whether database created or not 

    if($newdb)
    {
        //setting database name to connect for database operation
        $setDbName="student";

        //query for connecting database
        $connectionTesing=mysqli_select_db($connection,$setDbName);

        if($connectionTesing)
        {
            echo "Connected!";
        }
    }
}

?>