Skip to main content
Faculty and Staff

Accessing MySQL using phpMyAdmin

phpMyAdmin is a tool which allows to access MySQL using a fairly simple Web interface. Before you can begin to design your tables, the Webmaster must set up a database account for you. If you do not already have a database account please fill out the Database Account Request Form.

Definitions

A "database" is made up of one or more "tables". Tables are the actual location of all the data and information about your database. While you may only have one database, you may have more then one table to store independent data. This tutorial explains how to make these tables.

You can access phpMyAdmin from the following address:
http://www.uri.edu/phpmyadmin

Select a server to begin using the dropdown box provided. When prompted for your username and password, please enter your database account login and password. You should now see a screen like the following:

phpMyAdmin Welcome Screen

Creating a Table

In the left hand column you will see the five (5) images, followed by the name of your database. Click on the name of your database to begin to create a table. You will arrive at the following screen:

Creating New Table

To create a table, use the "Create New Table on Database..." section. In the Name field, enter what you want to call your table. You should name the table something that makes sense, so you can easily remember what the table is for.

In the Field field enter the number of fields you wish to have in your table. A database table must have 1 numeric index field, which we will discuss more in a moment. Please take this into account when deciding on the number of fields to enter. Click Go and you will be taken to a screen similar to this one:

Creating Table Fields

Creating Table Fields

Each row on this screen represents one of the fields of your table. The first field is going to be our index number field. Therefore you should name it accordingly, something along the lines of RecCount, or IndexNum. Enter this name in the first rows Field column. In the Type dropdown box select MEDIUMINT. This tells the database that this field is Integer numbers. You can skip the next 5 fields in this row and go to Extra, in this dropdown box select auto_increment. This option causes this Index number to be automatically incremented for each new record. Next select the radio button in the Primary column. This lets the database know that this is our main index field.

Now you may go on to the next row. For instance, lets say our next field was First Name. First enter a name for the field (ex. FirstName), now in the Type box select VARCHAR. This says that this field will be text, rather than a number. In the Length box enter the number of characters you want to have for this field. This restricts how many characters can be entered in this field. If you had a field for local phone numbers, you could set the length to 8. VARCHAR supports a max of 255 characters. If you need to store more characters then this (say to store an article or paper) you could use the type TEXT or MEDIUMTEXT which allow you to have a maximum 65,000 or 16 million characters, respectively.

Once you have entered the Name, Type and Length, the field should be complete and you can move onto the next.

You should note that there are a few other useful field types, such as DATE, DATETIME, or YEAR. Which as you may have guessed are used to store dates, times and years. There are also other types for decimal numbers and integers of various lengths. If you need to use one of these fields or are trying to find a field type that best fits your needs, click on the Documentation link at the top of the Type column for more information about the various types.

Once you have finished entering all your field information, click the Save button to continue on. For your reference here is an example of a completed field creation screen:

Completed Database Fields

Once you hit the Save button you will be taken back to the main screen for your database. You will notice that now your table is listed on this page, as well as in the left-hand column.

Table Location Example

Modifying Tables

We need to modify a few more things in the table before we can be done. To make modifications to the table click on the Structure link for your table and you will be taken to a page that looks similar to this:

Table Structure Example

In the row that lists your Index field (indexNum in the example), click on the Unique link. When the page reloads, click on the Index link. Now your database is complete and ready to be used. However you should note many of the options on this page.

This page is where you come if you need to make any changes to your table. If you need to change the Name or Type of a field, simply click the corresponding Change link and you will be given the option to change all or some of the fields properties. To remove the field from the table click the Drop link in that fields row. Note!! If you click the Drop link at the top of the page you will delete your whole table!

Also, if you scroll down further on this page, there are sections for adding new fields to the database, renaming the table, and much more.

Adding Records

By clicking on the Insert link at the top, you can begin to add records to the Database. However entering records via the Web can be tedious and time consuming. A better way to enter your data is to link up Microsoft Access from your computer to the remote database.

Once you have finished creating and modifying your table and fields, you can simply close your browser to log out. Remember, you can have more than one table in a database. So if you want to have more then one data storage area, just repeat these steps.

Forms

ITS Web Account Application Form

Departmental Web Server Registration

Request a Link

Request to add/update a hyperlink to my page on the main URI Web site.

What if the Webmaster made a mistake!

WEB PUBLISHING BLOG

Subscribe to the URI Web Publishing Blog for latest news, tips, resources and tools related to web technologies.

Web Publishing Listserv

Subscribe to URIWEB-L Listserv to keep informed of ideas on web-related issues on campus.