Installing/Using MySQL on RedHat Linux

This workshop discusses how to install and use MySQL on RedHat Linux.

Introduction

What is a database?

According to www.WhatIs.com, a database is:
A collection of data that is organized so that its contents can easily be accessed, managed, and updated. The most prevalent type of database is the relational database, a tabular database in which data is defined so that it can be reorganized and accessed in a number of different ways. A distributed database is one that can be dispersed or replicated among different points in a network. An object-oriented database is one that is congruent with the data defined in object classes and subclasses.

Databases contain aggregations of data records or files, such as sales transactions, product catalogs and inventories, and customer profiles. Typically, a database manager provides users the capabilities of controlling read/write access, specifying report generation, and analyzing usage. Databases and database managers are prevalent in large mainframe systems, but are also present in smaller distributed workstation and mid-range systems such as the AS/400 and on personal computers. SQL is a standard language for making interactive queries from and updating a database such as IBM's DB2, Microsoft's Access, and database products from Oracle, Sybase, and Computer Associates.

Why use a database?

Simply put, databases enable a variety of client types to access data in a standard way. Instead of repeatedly developing unique, proprietary methods of accessing certain types of information, a single database system can provide a central repository, or "data haven," for all an organization's information. By centralizing the data, we reduce duplication of system management at the expense of creating a single point of failure (though database systems can be mirrored to prevent this sort of problem).

Why use MySQL?

For the purposes of this workshop we plan to use MySQL because it remains one of the most popular, best-supported free (GPL) database systems today. Also, it supports a subset of the ANSI/ISO SQL standard. According to www.WhatIs.com:
SQL (Structured Query Language) is a standard interactive and programming language for getting information from and updating a database. Although SQL is both an ANSI and an ISO standard, many database products support SQL with proprietary extensions to the standard language. Queries take the form of a command language that lets you select, insert, update, find out the location of data, and so forth. There is also a programming interface.

Installing MySQL

Once you set up a server, you can access it from any location you want. Therefore, the server and client come in separate parts. For the purposes of this workshop, however, we plan to run the server and client on the same computer.

Installing the Server

First, using a web browser, you should download the server RPM from the following location: http://www.mysql.com/Downloads/MySQL-3.22/MySQL-3.22.32-1.i386.rpm Once you download the server, change to the super user account and install the software as shown below.
[root@timpc tim]# rpm --install MySQL-3.22.32-1.i386.rpm 
Creating db table
Creating host table
Creating user table
Creating func table
Creating tables_priv table
Creating columns_priv table

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/usr/bin/mysqladmin -u root password 'new-password
See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at http://www.mysql.com
Support MySQL by buying support/licenses at http://www.tcx.se/license.htmy.

Starting mysqld daemon with databases from /var/lib/mysql
[root@timpc tim]# 

Installing the Client

First, using a web browser, you should download the server RPM from the following location: http://www.mysql.com/Downloads/MySQL-3.22/MySQL-client-3.22.32-1.i386.rpm Install it ... Once you download the package, install it as shown below.
[root@timpc tim]# rpm --install MySQL-client-3.22.32-1.i386.rpm
[root@timpc tim]# 

Securing the Server

Like other services you install on the server, MySQL opens up a network port to which anyone may attach. Not only that, but MySQL's authorization mechanism does not consider file (or other) restrictions the system maintains on a user's login account. This means that any user can access the database if they know the username and password of a valid database user. Therefore, every database account you create (even/especially if you call it "root") should have a secure password. As of this document's writing (7/14/2000), MySQL clients send their passwords in the clear across the wire. To keep you server secure:

Learning MySQL

The rest of this workshop relies on the MySQL documentation's tutorial, with the following suggestions:

Wrapping It Up

This concludes the workshop. To see how well you understand MySQL, I recommend going back to the PHP workshop and making the final project use MySQL instead of the "dbm" functions. You should rely on the PHP MySQL function documentation to get help. Functions of special interest include:



















Last Updated on Fri Jul 14 12:27:37 CDT 2000 by Tim Christian (tim@unt.edu)