Using MySQL and Databases
MySQL is a database server which you can use to store information in. You usually
can add, remove and change data using a PHP script.
You can also use phpMyAdmin to access and
work with your database manually.
Setting Up Your CGI and Database Accounts
To get started, you will need both a CGI account and a MySQL database. Active
Web Hosting provides these for each domain you have online. However, there is
a limit of only one database per domain. Here are a couple links that
will help you set up your CGI and Database accounts. Note that you must
request the CGI account first. When that is online, you can then request
the MySQL database.
Database Tables and Fields
A database is an area where you can store data which can come from your web
pages or a script. Think of a database as a container. You only are
given one database per domain.
In each database you will store tables, shown as big green areas below
labeled as scriptname_users and scriptname_cars. Tables are used
to store fields (shown in yellow boxes below) which contain your data
(shown in white boxes below). For example, here is a graphical view of
how your data is stored:
You'll notice that tables are sort of like spreadsheets, in that they contain
rows (fields) and columns (the data in each field). You can have
an unlimited amount of rows and columns (ie. fields and data) in your tables,
and an unlimited amount of tables in your database. However, the more you have,
the longer it will take to access, search and retrieve information from your
database.
Using Table Prefixes
Some scripts will let you define a prefix to refer to your tables. In
the above example, the table prefix was scriptname_ for both the users
and cars tables. The name of the table would actually be scriptname_users
and scriptname_cars. The reason it's best to use prefixes is because then
data from each script will not overwrite or merge with each other if they happen
to have the same field name.
For example, say we had two scripts, forum and cars. Both would
need to store data in a field called users. This might be a problem as
the users from one script would be merged with the users from the other. So, we
would give the forum tables the forum_ prefix and the cars
tables the cars_ prefix. The tables would then be called forum_users
and cars_users instead of just users. Prefixes help keep your
database more organized. This is very important since you only have one database
to work with.
Using Your Database
You can access and manage the information in your database, add, remove, and
change information in a variety of ways. The most common way is through a
php script. For more information on how to use php and your database,
please see our tutorial Using PHP.
Another way is to use phpMyAdmin, a database manager on Active
Web Hosting's servers. You can use this to access and manage your database:
phpMyAdmin Database Manager Page
You might want to bookmark that page. Log in using your database username
which is your actual domain name but without the dot (such as yourdomaincom),
and your database password. Please do not confuse your database
password with your CGI server password as they are two separate things.
On the left you will see a your domain name. This is your database. This is
where any database tables will be listed that you or a script you
installed had created.
From here you can import or export database tables or manage your database. See
your FAQs below for more information:
Another good resource for information is the
phpMyAdmin Documentation.
|