Tip:
Highlight text to annotate it
X
Hello Students! Welcome to my introduction to phpMyAdmin at LBCC.
Okay so what we need to do - we're going to be using phpMyAdmin to interact with our database
server. What you need to do first is to login, go to the url of the phpMyAdmin tool. And
that url is http://wcbis.lbcc.edu/phpmyadmin.
Once you get there you should see something like this asking for your username and password.
You've already been given your username and password in an email that was sent out at
the beginning of the semester. For those of you with FPT accounts, it is the same username
and password that you are using for FTP. The format of your username is going to be your
last name an underscore and your first initial. This is going to be all lowercase. And then
your password is going to be your 7 digit student id number. Don't include a W, just
use actual numbers.
After you put that in, click Go. You are taken to the main page of the phpMyAdmin tool. This
is a program written in PHP, basically a bunch of PHP forms that interacts with our MySQL
database. I'll give you a little overview here. On the left side is your navigation
menu. You'll see your last name and you'll see a couple of databases underneath your
last name. If this if your first time logging in and you haven't created anything yet, you
won't see anything under your last name. For those of you who have already made some sample
databases with me in class you may see one or two databases listed under your name.
Across the top, you'll see tabs. These tabs change depending on what action you are performing
in the system. Okay, so the first thing that we want to do is create a new database. The
format for that is special.
Delete the information in the CREATE DATABASE box because it's incorrect. The name of your
new database should be in this format - your username (last name underscore first initial)
and then one more underscore and then the name of your database. For example, let's
say we are doing homework 4, you will name your database username_hw4. Now keep in mind
whatever you name your database, try to keep it specific to what you are doing because
I will have access to all of your databases and if you name it something random I won't
have any idea where to look. So if you are doing a database for homework 4, please call
it homework 4. If you are doing a database for the final project, then please call it
final or something along those lines.
After you've put in your database name, click on the CREATE button. Every statement you
run gets interpreted by phpMyAdmin and interacts with the MySQL system by building the SQL
statement for you. Everytime you run something, you'll get a confirmation. If everything went
well, you'll get a green box. If something went wrong, you'll get a red box.
Okay, so, after you create a database you'll be asked to create tables. Don't you want
to add some tables? Of course we want to add some tables! So were going to do a sample
table that you've probably already done with me in class. This is for those who haven't
been in class. We'll call it USER. Please stick to our format - tables will be uppercase
and fieldnames will be lowercase. Also all tables should be singular. It will be the
USER table, not the USERS table. It would be the ACCOUNT table, not the ACCOUNTS table.
Let's just start with four fields and click go. This is basically the beginning of our
create table tool, although it doesn't really give you much information about what we're
doing, just know what it looks like. You'll see the breadcrumbs listed across the top
-- you'll see localhost (the name of the server), then the name of your database, and then the
name of the table. We'll start adding our field names. Remember in Access, the create
table section, where we identify the field name, field type, values, length? That's similar
to what we are doing here. So the first field we want to create is our primary key - again
it's going to be all lower case since it's a field name. We're going to call it user_id,
keep the type INT, and skip over to index and change to PRIMARY and check off of the
A.I. box (which stands for auto increment). We want the database to automatically supply
a primary key value to our user_id field depending on when we insert new data.
The next field we're going to enter is first_name. We're going to change the type to VARCHAR which stands for variable character
and enter the length of 30. We are going to leave everything else defaulted. Next we're
going to do last_name, same VARCHAR and length 40. Then the last field email_address, also
VARCHAR and 40.
Now if you realize you need to add more fields, you can go to the bottom and ADD more fields
and then click GO. Two more boxes will be created for you. Let's just say we don't need
those two boxes after all so we'll just click save. It is smart enough to know that we didn't
just create two empty fields. So you'll see again, in the top, the SQL code for CREATE
TABLE which identifies all of the information that we just created. In the structure you'll
see it lists all of our fields and special information like auto increment. If you wanted
to change one of these fields, you could click on the little pencil and change it. We're
not going to change anything right now. If you wanted to delete a field, you can click
the red x mark, but remember, if you have any data in that field it will also delete
all of the data that is associated with this field.
That is how we create a table in phpMyAdmin. In our next video, I'll show you how to add
data to this table. I'll see you in the next video!