Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How can i create a database using PHP and MySQL?

7:39 am on Nov 26, 2011 (gmt 0)

New User

joined:Oct 14, 2011
posts: 9
votes: 0

please send me these questions answar.theae are very important for me.

How can i create a database using PHP and MySQL?
8:17 am on Nov 26, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:May 18, 2005
votes: 0

You create a database in your hosting control panel. Then you can access the database also from your hosting panel to add fields and data. Using PHP you make the database work on your website. This is not something you can learn by reading a q&a doc. Maybe hiring a programmer would be a good idea.
9:23 pm on Nov 26, 2011 (gmt 0)

Moderator from CA 

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
votes: 0

it's true, typically you won't create a database using PHP. You'll create the database via direct access to MySQL, either with a control panel or directly from a command line interface.

Actually it's unusual to manipulate tables in PHP too; typically you'll define your table schema during app development, and in PHP you'll only be selecting, inserting, deleting and updating rows.

the command to create a database - when you're connected to it via command line or control panel - is "CREATE DATABASE ..."

Here's the syntax:

viva is correct - if you're working on a mission-critical app with a deadline, then you'll want to get an experienced programmer to do it right. SQL is a very *deep* topic with lots of little gotchas. But say you're doing this as a student to learn how it's done, then there are lots of great tutorials all over the www and excellent books you can read.

Good luck!
5:30 pm on Nov 28, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

In **most** systems, creating a database requires you do so as the root user of the domain (or a user with create database permissions, such as the "cpanel user") - which is a very dangerous thing to put in a script. This is why most open source CMS's, shopping carts, whatever, that connect to a database ask you to enter the user, password, and database name as the first step of installing their software.
8:52 pm on Nov 28, 2011 (gmt 0)

Full Member

5+ Year Member

joined:June 30, 2008
posts: 318
votes: 0

go to [wampserver.com...] and download and install their wamp server. It contains PhpMyAdmin. You can also go to [phpmyadmin.net...] , it's the offical site for PhpMyAdmin. Once installed onto your developement server, you can create your database from there or... if you have an account with a hosting service, you can use their PhpMyAdmin to create your database.

PhpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement.
9:08 am on Dec 1, 2011 (gmt 0)

New User

joined:Oct 14, 2011
posts: 9
votes: 0

Thank's to all for Give me a better solutions.