We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

Create Database using MySqladmin

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.


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

[root@host]# 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.


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.


Creating a database:


  1. <html>
  2. <head>
  3. <title>Creating  your own MySQL Database</title>
  4. </head>
  5. <body>
  6. <?php
  7. $dbhost = 'localhost';
  8. $dbusername = 'root';
  9. $dbpassword = 'rootpassword';
  10. $con = mysql_connect($dbhost, $dbusername, $dbpassword);
  11. if(! $con )
  12. {
  13.   die('Could not connect: ' . mysql_error());
  14. }
  15. echo 'Connected successfully<br />';
  17. $Result = mysql_query( $sql, $con );
  18. if(! $result )
  19. {
  20.   die('Could not create database due to error: ' . mysql_error());
  21. }
  22. echo "Database TUTORIALS created successfully without any error\n";
  23. mysql_close($conn);
  24. ?>
  25. </body>
  26. </html>
Facebook Comments
(Visited 17 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: