Nebula Research and Development

Getting Started with MySQL
 
A Pick Perspective

 

Do you know nothing about getting started with MySQL but would just like to install and try it? Here's how, with occasional references and comparisons to the Pick/MV environments. No apologies, this info is entirely for Windows users. Once you're familiar with the Win32 implementation of MySQL, it should be easy to get familiar with the specifics of any other platform.

This article does not teach SQL, how to maintaintain databases or tables, or how to configure or maintain your server. That may be info for another article. It does start from the very beginning, starting and stopping the server, and getting access to the environment.

Why did I write this?

Because getting started with MySQL is very simple, but the documentation makes it sound so difficult. The docs talk about configuration files and switches and considerations for different platforms, and all sorts of things that don't apply to someone who just wants to see what this thing is about.

If you haven't installed MySQL yet, just download a binary install release from mysql.com and execute it on your PC using all of the defaults. It can't be much easier. This document assumes you've installed MySQL into the default c:\mysql directory. If not, there are a couple configuration settings that need to be changed. I'll skip that info - it's is covered in almost every Installing MySQL guide and ReadMe doc available. See your C:\mysql\Docs directory for a manual if you need more help just getting the software installed. I don't like to install anything in my root directory, but in this case it's better to get installed, figure things out and re-install later, rather than to spend all of your time messing with configuration specs and never getting to use the software.

So assuming at this point that everything is installed...

Under c:\mysql you'll see directory \bin. That has the executables to bring the database server up and down, as well as many other functions. Open a DOS prompt to that bin directory.

Like a Pick virtual machine, the MySQL server must be started so that it can be accessed by clients. To test the theory, let's look at a DOS-based client, "mysql.exe". This is just a DOS interface to the server, it's not "MySQL itself". At the command prompt, type "mysql" and press enter.

You may see this:
ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)
Or you may see this:
Welcome to the MySQL monitor....

If you get a Welcome, the server is up and you will get the "mysql>" client prompt. Use 'quit' to get out at any time.

Another way to see if the server is up or down is to use the command:
mysqladmin ping
This will either tell you it can't connect to localhost, or it will say "mysqld is alive".

The program mysqld.exe is the server process. Note the "D" meaning Daemon - just another word for Server. Other executables are mysqld-max and mysqld-nt. Each one of these executables support different functions. Configuration "mysqld-nt" is the one we'll see by default, supporting the most options.

The server can be started in the foreground or the background. Foreground just ties up a DOS screen so we'll look at the background options. The install process creates a Windows Service which may be set to start automatically after a reboot. That service just executes "mysqld-nt.exe" You can start the service manually using:
net start mysql

To shutdown the server from the command line, use:
net stop mysql
Or use mysqladmin again:
mysqladmin shutdown
The server can also be shutdown using the normal Services Management Console in Windows.

For GUI tools, one that comes with the standard download is WinMySqlAdmin.exe, also in the bin directory. Clicking on this file in Windows Explorer executes the GUI. As soon as it starts, it minimizes itself to the task bar - don't execute it more than once! If MySQL isn't up when the GUI is started, the service is started. If you look in the task bar, you'll see a red, yellow, green stoplight. Green means the server is up, red means down, yellow means it's in transition. Terminating this admin program does not shutdown the server. You can right click on the icon and click ShowMe to actually see the GUI, and you will see options to start/stop the server here as well.

For easy access, I've created icons on my desktop for "net start", "net stop", admin, control center, and MySQL-front - no DOS prompts necessary.

OK, we can start and stop the server. How about actually using MySQL? The Admin program is not for using the environment really, just for monitoring status. There are many popular GUIs for this database, people even use Excel and MS Access as clients. Of the free clients, a couple are popular for Windows. MySQL-Front is very popular but some people say it's no longer maintained. The web site seems to indicate otherwise. You can download MySQL Control Center (MySQLCC). This isn't a full-featured GUI yet, it's a little buggy, but it is a 0.9 beta in development. It's free for now but that might not be permanent. (Note that MySQLCC also replaces MySQL GUI - don't get too enamored with your tools, they tend to come and go.) A combination of these tools should help to get started using the environment. As you start to use the GUIs you'll see their limitations. Some don't display data nicely, others don't let you easily save your SQL queries for future reference, etc. Search the net for more GUI options, some will be free and others will cost something.

What do you do inside the GUI? This is where we need to understand SQL and the relational world. There are MANY similarities between that world and the Pick world, it's mostly a matter of understanding the syntax, not the concepts. Maybe one of these days I'll do an article on that... In the mean time, there are a number of good books that specialize in MySQL for beginners and advanced usage, and there are a ton of similar web sites.

Good luck!
Tony

 

 
 

© 2009 Nebula Research and Development

Home | About Us | News | FAQ | Products
Services | Articles | Contact Us | Search Site

E-mail for Product and Service inquiries.
Please report site issues to . Thank you!