MySql Database

mysql, w3schools
mysql, w3schools

MySQL is a freely available open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). Its is the most popular database management system for small- to medium-sized web projects. It uses a client server model which tipically means the database host on a server and the data will be access on clients systems.
You would require uncommon credentials to make or to erase a MySQL database. So accepting have access to the root user, you can make any database utilizing the mysql mysqladmin binary.


Here is an easy example to make a database called W3Schools −

[root@host]# mysqladmin -u root -p create W3Schools
Enter password:*****

This will make a MySQL database called W3Schools.

Make a MySQL Database using PHP

You can create MySQL Database by using PHP. PHP uses mysql_query function to make or erase a database. mysql_query function takes 2 parameters and return the value True on successful execution and False on unsuccessful execution.

bool mysql_query( sql, connection );

      <title>Create MySQL Database using PHP</title>
         $dbhost = 'localhost:3036';
         $dbuser = 'root';
         $dbpass = 'rootpassword';
         $conn = mysql_connect($dbhost, $dbuser, $dbpass);
         if(! $conn ) {
            die('Could not connect: ' . mysql_error());
         echo 'Connected successfully<br />';
         $sql = 'Create MySQL Database using PHP';
         $retval = mysql_query( $sql, $conn );
         if(! $retval ) {
            die('Could not create database: ' . mysql_error());
         echo "MySQL Database using PHP created successfully\n";