dacs.doc electric

 

MySQL On Windows

By Richard F. DiFranco

 

I had previously heard of MySQL as a database system that runs under Linux. I was very pleased when I found in a newsletter that MySQL has a version that runs under windows. I went to the web site and sure enough it was available.

Website

The MySQL website has all the downloads and information I could want about the database system. There is a newsletter and manuals and articles to keep me busy for a long time. I recommend a look. MySQL is also available for purchase or really, paid support is available. The database system is produced and distributed by MySQL AB a Swedish Company. I must say they have done a great job of getting the documentation translated to English.

The Download

I started the download on the afternoon of the Great Blackout of 2003. Luckily I downloaded to a new lap top which had a fully charged battery. Of course, the phones run on battery power and didn’t go down. The download took about an hour and a half. MySQL has a great number of mirror sites from which you can download. I chose the University of Pittsburgh and had no problems. The downloaded file is 22 megabytes. I downloaded to a Dell Inspiron 5100 with a Pentium 4 processor, running Windows XP. I have a forty Gigabyte hard drive so space is not an issue. The zipped files were no problem.

The Install

The install took maybe two minutes; most of which was my fumbling.

Documentation

The full manual is part of the download. It is also available on line at the MySQL Site. The manual is very big and detailed. It covers problems with installing on all flavors of Unix. Update policy and future plans are covered in detail. I started reading the manual from the beginning because I didn’t know exactly how to get started. The manual appeared, at first, to be Unix oriented but there is plenty of material for Windows. On reaching chapter three, I really found what I needed to get things started. That is what I talk about in Usage.

WinMySQLadmin

WinMySQLadmin is a program that comes with the download and is used for admin tasks such as adding users and passwords and clean up. I bring it up here to comment on the translation of the WinMySQLadmin documentation. It needs some work.

Usage

What I was really looking for was a substitute for Microsoft Access. MySQL is in a different league. It is usually compared to Microsoft SQL Server. Indeed that is what is downloaded; a database server and a client, and of course, much more. I wanted a very basic home system that would help me to learn SQL and the MySQL suite. There are many more facilities and programs, such as MySQLCC, an API for accessing the server from Java or even from Microsoft Access. I hope to make those topics of future papers.

One of the first programs I ran was WinMySQLadmin. It is a GUI form of the admin program and I would guess it is unique to the Windows version of MySQL.

I must point out, at this point, that I started all of these programs from the Command Prompt. In older versions of Windows, the Command Prompt was referred to as the DOS window and I once came across a book in which it had to be explained for people who only know GUIs and Windows. The Command prompt under Windows XP is more useful than it was under DOS in that it is a window and can be scrolled up and down. This makes it a kind of work space in which you can see all of what you have done in a session.

Getting back to WinMySQLadmin; I can’t find a specific reference but in running it I was able to have the server portion, MySQLd, installed as a service under Windows XP. That means that both WinMySQLadmin and the server, MySQLd start up every time I boot. WinMySQLadmin gives you a window into the server environment. It gives displays of the server machine and operating system, server statistics, error file, system variables, and a display of databases and tables.

Database Server

The server portion, MySQLd, is meant for a multiuser system and is intended to be run on a server machine in a networked environment. I found it works quite well with both the server and client on the same machine. Every system comes with an already created database named MySQL. It is a directory to other databases. There is also a test database named Test that can be used by the user.

The Client

The client is named Mysql. It is also called a terminal monitor and is used for interactive SQL queries and building databases and tables. The client must be started in the directory Bin. Chapter three of the manual has a fine tutorial for getting started. It starts by having the user enter some queries that don’t even require tables such as Select version(), current_date;. Then the tutorial gives you commands to build databases and tables. There are examples of insert commands and selects of many kinds. There is, of course, an Update command to go back and fix records.

I was able to create my own database and add a table, then insert some records. I did some selects to see that everything was ok. With this facility I should be able to build proficiency in SQL and keep the data bases that I want for my own records.

Batch Facility

MySQL allows the user to build standard jobs. That is, commands can be placed in a file and then submitted to MySQL for execution from the command prompt. I was able to type a simple select statement into a file using Notepad and then execute it in the command window, like this:

c:\mysql\bin> MySQL <booksall.txt

I found that I had to precede the Select with an instruction to use the database in which I created my Books table. So the file contents looked like this:

UseRichardInc;
Select * from Books;

MySQL doesn’t yet have a stored procedure facility. It has been promised in coming revisions.

Printing

Using the command file or batch facility leads to printing results, however crudely. To get a printable listing I resubmitted my batch file with an outgoing indicator:

c:\mysql\bin>mysql < booksall.txt > booklist

This gave me a text file that I can print. The listing lacks formatting but it was good enough for a first cut.

Pushing on I have added more records using Insert and I have adjusted a record with Update.

Other

According to MySQL AB, the name is pronounced My Ess Que Ell but if you want to call it something different, they won’t complain.

MySQL is already big and well known but I think it is just starting to grow in North America. As Linux grows so will MySQL and with a good working version for windows, more people will be discovering this product. At present, people may find it a little formidable because it must be used through the command prompt with SQL commands. The next piece that I want to down load is the MySQLCC which is the command center. I suspect from what I have read so far that this is a more convenient interface.

It was my intention to outline how to get MySQL up and running a quickly as possible and that meant leaving out a lot of information about security and administration. I feel that I can learn those pieces and add them as my needs demand. I think a look at the manual and website will show how versatile and powerful MySQL can be. And, of course, the price is hard to beat.


Rich DiFranco has been a DACS member since the Brookfield library days. Programmed in FORTRAN, COBOL, and Paradox Now learning the new platforms as well as producing an occasional essay.

BackHomeNext

© Copyright Danbury Area Computer Society, Inc. 1998-2003 All Rights Reserved
Web Site Terms & Conditions of Use