LJ Archive

Resources

MySQL is available in a variety of forms. If you are running Red Hat Linux (or any other version using the RPM packaging system), you should be able to download it from any Red Hat FTP site. For Intel-based platforms, you can download these from:

The first RPM contains the basic MySQL server package, including programs necessary to administer the database server. The client package contains the mysql and mysqlshow client programs, the former of which is used in the “At the Forge” examples. Finally, the Perl package contains the mysql object module, which can be used to create database client programs from within.

To install these on a system with RPM, download the above files and enter the following command while logged in as root:

rpm -Uvh mysql-3.20.25-1.i386.rpm
rpm -Uvh mysql-client-3.20.25-1.i386.rpm
rpm -Uvh mysql-perl-3.20.25-1.i386.rpm

The above commands install (with some extra information about the installation's progress, thanks to the -v and -h switches) the MySQL server, client programs and Perl object modules. In order to start the MySQL server, you need to start the mysql initialization script, which runs automatically whenever your system starts up. This program is typically located in the /etc/rc.d/init.d directory. To execute, type:

/etc/rc.d/init.d/mysql start

Note that you must be logged in as root in order to run this command.

At this point, you should be able to start the mysql client program, and to try out SQL queries. For starters, try creating the tables mentioned in this month's “At the Forge” and then try to retrieve data from the tables.

If your system does not support RPM or if you prefer to compile the system on your own, you can do so by downloading the source from http://www.tcx.se/. This site also contains binaries for other Unix systems, ODBC packages for Windows 95/NT, clients for Python and Java and information on the MySQL mailing lists.

An excellent SQL tutorial is available on the Web at http://w3.one.net/~jhoffman/sqltut.htm.

This tutorial discusses the SQL commands you are most likely to need in your work, along with enough information to progress beyond the mere basics.

For a slightly heavier-duty and academic look at SQL, you might want to try Databases: Principles, Programming, and Performance, by Patrick O'Neil (ISBN 1-55860-219-4). This book goes into more detail on the inner workings of SQL than the average programmer is likely to need, but the explanations are clear, with the underlying theories spelled out in just enough detail for what developers need.

LJ Archive