Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Jan 3, 2002

Installing MySQL (Under Windows) - Page 3

By Kevin Yank

As I mentioned above, MySQL may be downloaded free of charge. Simply proceed to http://www.mysql.com/downloads/ and choose the recommended stable release (as of this writing, it is MySQL 3.23). Under the heading of Standard binary (tarball) distributions (which basically means the program doesn't need to be compiled, and is ready to run once you download it), find and click Windows 95/98/NT/2000 (Intel). If you're on a high-speed connection, you'll probably want to check out one of the download mirrors listed at http://www.mysql.com/downloads/mirrors.html to get a reasonable download speed. After downloading the file (it's about 12MB as of this writing), unzip it and run the setup.exe program contained therein.

Once installed, MySQL is ready to roll (barring a couple of configuration tasks that we'll look at shortly), except for one minor issue that only affects you if you're running Windows NT/2000/XP. If you use any of those operating systems, find a file called my-example.cnf in the directory to which you just installed MySQL. Copy it to the root of your C: drive and rename it to my.cnf. If you don't like the idea of a MySQL configuration file sitting in the root of your C: drive, you can instead name it my.ini and put it in your Windows directory (e.g. D:\WINNT if Windows 2000 is installed on drive D:). Whichever you choose, open the file in WordPad (Notepad is likely to display it incorrectly) and look for the following line:

# basedir = d:/mysql/

Uncomment this line by removing the '#' symbol at the start, and change the path to point to your MySQL installation directory, using slashes (/) instead of backslashes (\). For instance, I changed the line on my system to read as follows:

basedir = d:/Program Files/mysql/

With that change made, save the file and close WordPad. MySQL will now run on your Windows NT/2000/XP system! If you're using Windows 95/98/ME, this step is not necessary -- MySQL will run just fine as-installed.

Just like your Web server, MySQL is a program that should be run in the background so that it may respond to requests for information at any time. The server program may be found in the "bin" subfolder of the folder into which you installed MySQL. To make things complicated, however, there are actually several versions of the MySQL server to choose from:

  • mysqld.exe This is the basic version of MySQL if you run Windows 95, 98, or ME. It includes support for all advanced features, and includes debug code to provide additional information in the case of a crash (if your system is set up to debug programs). As a result of this code, however, the server might run a little slow, and I've generally found that MySQL is so stable that crashes aren't really a concern.
  • mysqld-opt.exe This version of the server lacks a few of the advanced features of the basic server, and does not include the debug code. It's optimized to run quickly on today's processors. For beginners, the advanced features are not a big concern. You certainly won't be using them while you complete the tasks in this series. This is the version of choice for beginners running Windows 95, 98, or ME.
  • mysqld-nt.exe This version of the server is compiled and optimized like mysqld-opt, but is designed to run under Windows NT/2000/XP as a service. If you're using any of those operating systems, this is probably the server for you.
  • mysqld-max.exe This version is like mysqld- opt, but contains advanced features that support transactions.
  • mysqld-max-nt.exe This version's similar to mysqld-nt, but has advanced features that support transactions.

All these versions were installed for you in the bin directory. If you're running on Win98x/ME I recommend sticking with mysql-opt for now -- move to mysqld- max if you ever need the advanced features. On Windows NT/2000/XP, mysqld-nt is my recommendation. Upgrade to mysqld-max-nt when you need more advanced features.

Starting MySQL is also a little different under WinNT/2000/XP, but this time let's start with the procedure for Win95/98/ME. Open an MS-DOS Command Prompt and proceed to the MySQL bin directory, then run your chosen server program:

C:\mysql\bin> mysqld-opt

Don't be surprised when you receive another command prompt. This command launches the server program so that it runs in the background, even after you close the command prompt. If you press Ctrl-Alt-Del to pull up the task list, you should see the MySQL server listed as one of the tasks that's active on your system.

To ensure that the server is started whenever Windows starts, you might want to create a shortcut to the program and put it in your Startup folder. This is just like creating a shortcut to any other program on your system.

On WinNT/2000/XP, you must install MySQL as a system service. Fortunately, this is very easy to do. Simply open a Command Prompt and run your chosen server program with the - install option:

C:\mysql\bin> mysqld-nt -install

This will install MySQL as a service that will be started the next time you reboot Windows. To manually start MySQL without having to reboot, just type this command (which can be run from any directory):

C:\> net start mysql

To verify that the MySQL server is running properly, press Ctrl- Alt-Del and open the Task List. If all is well, the server program should be listed on the Processes tab.

MySQL Archives

Latest Forum Threads
MySQL Forum
Topic By Replies Updated
MySQL in high availability and transction secure banking application klamor 1 August 28th, 10:24 AM
MySQL rollback UAL225 1 August 28th, 10:15 AM
Browsing a DB file that uses MySql finleytech 1 July 26th, 10:51 AM
php cookie won't pass variable to next page ITdevGirl 0 June 22nd, 12:13 PM