This tutorial will show how to create and populate a basic database using cPanel and phpMyAdmin.
First log in to your cPanel account and click on the icon that says MYSQL Databases

You should now see a screen showing your mySQL information.

We will need to create the database. I will call my database test. Under current Databases in the New Database field type the name of your database, test.

Then select create database, you will be forwarded to a screen that tells you the database was added. Click the go back button to return to management screen.

Now you should see your new database listed under current databases. Notice the naming convention of my database teamc42_Test. This is the (cpanel user)_(database name). The reason that my databases are named that way is because we are using shared hosting for our test site. If you are using a shared hosting package your databases will be named in a similar manor, to keep you ‘test’ database separate from another users ‘test’ database. If you are on a dedicated host the database name will probably just be ‘test’.
In order to access the data we need to add a user and give the user a password. I will call me user ‘testuser’ instead of just ‘test’ to avoid confusion with the actual database. Enter the username and password and then click the ‘Create User’ button.

You will be forwarded to a page telling that the user was added. Click the go back button to return to the previous page.
You will now see that you have a user and a database listed under ‘Add users to your database’. Now we will do just that, add the user to the database. Select the user select your test user and your database. We will give the user all permissions, so check the all permissions box. When you are finished click add user to database. You will be forwarded again and cPanel will let you know that a user was added to the database, click the go back button.
When you return to the Account Maintenance Screen you will now see that you have a user added to your database, and you will also see that cPanel gives you the connection strings for Perl and PHP.

Our database has been created successfully, but now we need to add some sample data. To do this, scroll down to the bottom of the Account Maintenance Screen and click the phpMyAdmin Link. You should be redirected to the phpMyAdmin screen.

On the left you will notice that is says “No tables found in the database”. We need to add a table so that we can add some data. Click on the link for your test database on the left (teamc42_Test in my case).
We can now create a table in our database. I will call my table ‘TestTable’ and give the table 4 fields and then hit the go button.

Now we can add the information for our table fields. For the first line we will create an ID field. We will make this field the primary key. The primary key must be a unique value so we will make the ID field an auto generated integer. Enter the following information:
Field: ID
Type: Integer
Length/Values: 4
Collation: (blank)
Attributes: (blank)
Null: Not Null
Default: (blank)
Extra: auto_increment
Then we will select the option button for primary key (pictured below).

Then enter the following information for the other 3 fields.
Field 2
Field: FName
Type: Varchar
Length/Values: 30
Collation: (blank)
Attributes: (blank)
Null: Null
Default: (blank)
Extra: (blank)
Field 3
Field: LName
Type: Varchar
Length/Values: 30
Collation: (blank)
Attributes: (blank)
Null: Not Null (this tells mySQL that you must enter a last name)
Default: (blank)
Extra: (blank)
Field 4
Field: PHON
Type: Varchar
Length/Values: 12
Collation: (blank)
Attributes: (blank)
Null: Null
Default: (blank)
Extra: (blank)
When you are finished hit the save button. You should see the following information:

We can now add data to the table. Click TestTable on the left menu.

Now click the insert button located at the top of the screen.

You can now enter your test data. Remember to leave the ID field blank because it will be auto generated.

I will enter two records and then click the go button. MySQL will tell you that the data was inserted.

To view the data in your table click the browse button at the top. The data should be displayed like below.

You have successfully populated your table. You can now close the window. The next step would be to build to access the data through a web application (I prefer PHP). If you return to the Account Maintenance screen you will see that cPanel has given yout he connection string if you would like to get started. I will continue this tutorial to show you how to access the data later on. Look for a part 2 to this tutorial soon.
Chris on May 24, 2007 at 12:38 am
Thanks! This helped me a lot tonight.
[Reply]
Mirian on May 24, 2007 at 10:46 pm
Thank you sooooooooooooooooooo much. I was looking for something like this for a while now. Now I will look for your part 2. Mirian
[Reply]
m azam on May 27, 2007 at 1:28 pm
i get a lot knowledge from here
it a excellent site
thanks
[Reply]
Damian on June 25, 2007 at 9:43 am
this is what ive been waiting for, this has helped me a lot, I just wish there was part 2, because im a little stuck now, Im starting to understand the hole thing a little better now, my email is damiencurtis@hotmail.com, can anyone tell me how to add the tables in to my website and then add a search bar.
[Reply]
John Ward on June 25, 2007 at 10:49 am
I will try write part 2 of the tutorial soon. It will cover reading data from the database use php.
[Reply]
IZUAGBA EMMANUEL Reply:
April 7th, 2010 at 7:21 am
i want to know hw i will create a database without going to any computer school.
[Reply]
Josh Freeman on June 26, 2007 at 4:15 pm
Thanks for the great tutorial John. I’m looking forward to “part 2″… Please hurry : )
If you could give us an idea when you will post it, I would be thankful.
Josh
[Reply]
Damian on July 11, 2007 at 8:04 am
still waiting
[Reply]
sbaraqouni on July 24, 2007 at 7:16 pm
Really, It is very interesting
[Reply]
alie on July 27, 2007 at 2:05 am
Just checking …when is the next or the 2 part of the tutorial.I thank you for the last one,,,,very gooooooooooooooooood ….
C’ yah….
[Reply]
John Ward on July 27, 2007 at 6:32 am
Sorry, it has been a little hectic around here lately. I am starting a new job. I will try to get part two up as soon as I can.
[Reply]
hiutopor on September 17, 2007 at 1:06 pm
Hi
Very interesting information! Thanks!
G’night
[Reply]
jobuguina on October 17, 2007 at 9:44 pm
Thanks so much,
I am only starting for the database for my site, this really help me so much
God Bless
[Reply]
Nitish Anand on November 12, 2007 at 6:25 am
Good article on the databases. I was using the non-gui version but it helped me a lot. Further I would like to do is to send my users data from a html form to mysql database using the php script.
thx.
[Reply]
isam on November 13, 2007 at 4:25 pm
hi thank you so much for your partisipation can you please give some examples how can make a tables in my website which we can access the database and retrave the data? thanking your efforts
isam al hassan
[Reply]
eve on February 6, 2008 at 5:02 am
this was a great!!! help
thanks alot!!
[Reply]
Richard on March 20, 2008 at 9:49 pm
Great tips. In another lesson, I was doing everything through notepad and uploading via FTP each tme a change was made. It was taking awhile Good suggestions.
Do you know of any good GUI applications I could use to enter my data into the database.? I downloaded one called Navicat, and run it locally on my machine, but it didn’t seem to able to connect to my dbase on the web.
[Reply]
suresh on March 24, 2008 at 6:11 am
Its provide good database help with pictures and coding method.
[Reply]
Team Tutorials » Authentication with PHP/MySQL on March 25, 2008 at 11:02 pm
[...] MyAdmin Database Construction Access Database with PHP Creating Data for Database in PHP [...]
bob on March 27, 2008 at 5:32 pm
GnPHFd great site man thanks http://peace.com
[Reply]
Tuscon on April 24, 2008 at 7:00 pm
great panel options
[Reply]
Schools on April 26, 2008 at 2:11 pm
thanks for the great directions
[Reply]
Szdrdqqj on July 5, 2008 at 7:31 pm
cool site 10x
[Reply]
Gfhqrwpu on July 5, 2008 at 11:00 pm
Gloomy tales
[Reply]
Wtymshuk on July 6, 2008 at 4:23 am
good work man
[Reply]
Dave .E on August 21, 2008 at 8:31 am
yeah! is nice i must say, 4real i’ve been hooked up for some while now because of this, but my way is through.
thanx ‘ll
[Reply]
Erik on August 25, 2008 at 12:28 am
Thanks for the tutorial. Big help.
[Reply]
name on October 6, 2008 at 4:59 pm
comment5,
[Reply]
emo hair on October 11, 2008 at 10:44 am
good tutorial. will favorite this
[Reply]
Platzreife on October 12, 2008 at 3:31 am
Nice tutorial bro..!!
I was having some errors and your tutorials solved it in minute…
[Reply]
More traffic on October 13, 2008 at 11:36 pm
Absolutely great, and it’s real slick and simple. I am using it now on my website!
Thanks
[Reply]
paul on October 19, 2008 at 6:44 am
that great… when will you part 2 be out or how can i locate it
[Reply]
Lekan on November 8, 2008 at 6:32 am
Thanks for this tutorial, i really enjoy and it really helped me alot , you guys are genious
[Reply]
J.T. Thompson on December 9, 2008 at 3:17 am
It takes talent to create such an excellent tutorial with newbies in mind. This one tutorial was a great help to me. Thanks Much!!!!!!!!!!!!!!!
J.T.
[Reply]
Mohit on December 11, 2008 at 4:00 am
Was a lot of help. was easy to understand
[Reply]
Jennifer V. on January 19, 2009 at 11:34 pm
great info thanks
[Reply]
Sameer Shehzad on January 21, 2009 at 6:17 am
Hi,
It really very helpful
Where is next level details.
regards
sameer
[Reply]
Ciaran Pender on February 13, 2009 at 10:00 am
Hello
This is a great tutorial and exactly what I have been looking for,although I am having a problem.At the very start of the tutorial you say to create a HTML file that links into the search.php file just to make sure that the variable entered into the search bar is displayed,well it won`t display my variable entered -it opens a new tab which remains blank.I know that it is connecting to the search.php page beacuse when I change form action=search.php in the HTML to form action = searc.php it tells me that there is an error where as when I enter the correct file name it remains blank-any ideas?
Thanks alot
[Reply]
SBA on February 22, 2009 at 6:21 pm
Enjoyed the read, will bookmark.
[Reply]
Web Design Romania on March 4, 2009 at 7:21 am
At first it might seem hard to work with phpmyadmin … but … it’s quite easy and you’ll agree with me once you get a little experience with it.
[Reply]
mundia on March 19, 2009 at 7:41 am
What wonderful help, Danke
[Reply]
hoo on March 20, 2009 at 3:37 pm
Suuuuuupppper!!
[Reply]
Christine on March 21, 2009 at 12:03 pm
Omg I neeeeed a part 2. =P
[Reply]
Ravtan on March 27, 2009 at 4:30 am
can you please give some examples how can make a tables in my website which we can access the database and retrave the data?
[Reply]
Supun on April 10, 2009 at 11:44 am
Great work…….. im a newbie and was dying for this info
[Reply]
Usman on April 19, 2009 at 10:09 am
Its really very good tutorial. It help me a lot get create a database.
[Reply]
rama on April 30, 2009 at 2:02 pm
thanx, really it helped me lot,
great job
keep going
[Reply]
babatunde on May 21, 2009 at 12:55 pm
good job man
[Reply]
Priya on June 14, 2009 at 7:52 am
Thanks a lot. I was looking for a tutorial like this for a long time. It has helped me a lot.
[Reply]
mahendran on June 18, 2009 at 11:03 am
i am use phpmyadmin and launch database to the web server . any option to access the server db through the local phpmyadmin
[Reply]
John Ward Reply:
June 18th, 2009 at 6:33 pm
I believe you want to access a remote MySQL database locally. Unfortunately I do not know how to do this using PHP my admin. Have you tried Heidi SQL (http://www.heidisql.com/) yet? It the best GUI app I have found so far. In order to connect to a remote server using Heidi SQL you will need to be able to allow remote SQL access. If you have CPanel there is an option for remote SQL. If you do not know if you can do this ask you host if you can and how. I am also plannign to post a tutorial on how to do this if you host uses cpanel and allows remote SQL. Hope this helps.
[Reply]
Sanjay Gupta on June 24, 2009 at 5:26 am
We create an array and store it in the variable $array. We then open a database and
attempt to insert an element called “arraytest”, passing it the $array variable as the
value. We then test the return type from dbmfetch() when attempting to access
“arraytest” and ascertain that a string has been returned. In fact, if we printed the
value stored in the “arraytest” record, we would get the string “Array”. That would
seem to wrap up any hopes for storing arrays and objects.
Fortunately, PHP provides a feature that allows you to “freeze-dry” values of any
data type in string format. The data can then be stored in a database or file until it
is needed. You can use this technique to store arrays and even objects in a DBM
[Reply]
sam on August 7, 2009 at 9:52 am
thank you so much.coz i was ready to loose my job n coz of this tutorial,i worked out the problem
[Reply]
Compare Suppliers on August 8, 2009 at 4:55 pm
Thanks for the tutorial its a lot of help.
[Reply]
Clay Jackson on August 20, 2009 at 6:05 pm
Thanks, this was really easy to follow!
[Reply]
zolu on November 1, 2009 at 4:51 pm
That was so good!
where I can get part 2 ?
[Reply]
culvi on November 8, 2009 at 11:11 pm
Awesome clear tutorial. After three others this nailed it to the tee. Thanks for being very thorough! As a matter of fact, I am going to scour the rest of this site to see what I can learn. Thanks
[Reply]
Dave on December 2, 2009 at 5:57 pm
Hi John,
Any luck on accessing MYSQL databases using Heidi remotely. I run a webserver but want to manage it from the home office as it is to slow through the Cpanel.
[Reply]
John Ward Reply:
December 2nd, 2009 at 9:57 pm
Yes you can access a remote MySQL database using Heidi. If you have access to the mysql console you can grant remote privs to a specific user and/or you can do it in CPanel there is an option for remote my sql. You will either have to add the IP you want to access it or allow all remote IP addresses using a wild card %. So if you al;ready had a user called testuser and a database called testdb you could run this from the mysql console:
GRANT ALL ON *.testdb to ‘testuser’@'%’;
[Reply]
fibercement on December 7, 2009 at 10:25 am
Great job.Thanks a lot.
[Reply]
sove on December 16, 2009 at 1:49 pm
That was so good!..Thanks a lot.
[Reply]
tour comedy on January 6, 2010 at 12:27 pm
When you return to the Account Maintenance Screen the user added to your database can be seen, as well as the cPanel that gives the connection strings for Perl and PHP.
[Reply]
Naeem on January 6, 2010 at 1:21 pm
A Lot Of Thenx…….
[Reply]
Pooja on January 17, 2010 at 10:03 am
This isvery helpful
[Reply]
söve on January 17, 2010 at 3:09 pm
Great tutorial.Its my favorite site.Thanks.
[Reply]
shiv on March 12, 2010 at 9:08 am
Great
very help full for fresher in php
thank
shiv kumar
web developer
http://www.webconnecttechnologies.com
[Reply]
aaa on March 30, 2010 at 7:27 am
dasdasd
[Reply]
nati on April 25, 2010 at 3:18 pm
wow! i get what i need. really thank you. am waiting part two………
[Reply]
Emmanuel on June 18, 2010 at 6:21 am
Warning: require_once(Connections/fxtruth.php) [function.require-once]: failed to open stream: No such file or directory in /home/fxtruthn/public_html/newsletter.php on line 1
Fatal error: require_once() [function.require]: Failed opening required ‘Connections/fxtruth.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/fxtruthn/public_html/newsletter.php on line 1
[Reply]
John Ward Reply:
June 18th, 2010 at 8:04 am
That error is a simple one. It means that those files are not there and cannot be included. Check that you specified the correct path and file name.
[Reply]
Emmanuel Reply:
June 18th, 2010 at 10:10 am
I don’t understand pls, i want the website to be connected to my database. Thanks
[Reply]
John Ward Reply:
June 22nd, 2010 at 9:00 pm
This is just how to create the database. Take a look at our PHP tutorials section for basic on how to connect to the database.
roy on June 24, 2010 at 11:31 am
Hi!
What are the softwares you are using and where can I get them?
[Reply]
SHIBI on July 18, 2010 at 6:07 am
Thank you dude…….
[Reply]