How to install MySQL 4.0 on Windows

Warning: Abandoned
This page/script has been classified as abandoned and will no longer be updated. I will keep this page here indefinitely as a reference, but it will no longer be updated and I no longer offer support of any kind regarding content found on this page.

Note

This tutorial is for MySQL 4.0 and if you want the MYSQL 5.1 tutorial you are at the wrong place.

MySQL 4.0

  1. Download & Unpack

    Download and install MySQL from http://dev.mysql.com/downloads/mysql/4.0.html Just make sure you get a Windows 95/98/NT/2000/XP/2003 (x86) binary version.

    My file was named: mysql-4.0.18-win.zip
  2. Install MySQL v4.0

    Unzip MySQL to a temporary directory of your choice. (I used e:\mysql-setup\ for this) Open that directory then run setup.exe and install MySQL to somewhere like e:\mysql\
  3. Finding the Administration

    Unfortunately the latest version of MySQL I tried did not include any type Start Menu shortcuts. So manually go into your MySQL directory and look for winmysqladmin in my case it was at E:\mysql\bin\winmysqladmin.exe. Run it. After you enter your username/password it will minimize to the System Tray (by your windows clock) and there won't be a taskbar button.
  4. Starting MySQL

    There are several ways to start MySQL, but the easiest is to simply right click above the tabs on the Admin window, and select Win 9x or Win NT and start database or install/start service. (note: when you want to shut down the database, ShutDown this tool or hitting the windows "X" simply shuts down the Administration window, it does not stop MySQL. So be sure you get the "Stop this Service" first)
  5. Testing MySQL

    Testing MySQL is not exactly easy. However, here are the common connection strings for PHP and CGI. I've also started recommending people download phpMyAdmin and use it to create databases, etc.

    Security Note:
    Even though you entered a username/password, mysql runs using the username "root" and no password by default. Although mysql doesn't allow connections from remote hosts unless you specifically allow it, you should probably set a password for "root" and/or add new users. [more info on setting root password and adding users]
    PHP Connection test
    <?php
    // hostname or ip of server (for local testing, localhost should work)
    $dbServer='localhost';
    
    // username and password to log onto db server (what you entered in Step 4)
    $dbUser='root';
    $dbPass='';
    
    // name of database (what you created in step 4)
    $dbName='test';
    
        $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not connect");
        print "Connected successfully<br>";
        mysql_select_db("$dbName") or die("Could not select database");
        print "Database selected successfully<br>";
    
    // close connection
    mysql_close($link);
    ?>
    


    CGI Connection test (Must have DBI module installed)
    #!/usr/bin/perl
    
    print "Content-type: text/html\n\n";
    
    # DBI is perl module used to connect to the database
    use DBI;								 
    
    # hostname or ip of server (for local testing, localhost should work)
    $config{'dbServer'} = "localhost";
    
    # username and password to log onto db server (what you entered in Step 4)
    $config{'dbUser'} = "root";		
    $config{'dbPass'} = "";			
    
    # name of database (what you created in step 4)
    $config{'dbName'} = "test";			
    
    # MySQL driver (shouldn't need to change)
    $config{'dataSource'} = "DBI:mysql:$config{'dbName'}:$config{'dbServer'}";	
    
    my $dbh = DBI->connect($config{'dataSource'},$config{'dbUser'},$config{'dbPass'}) or 
    die "Can't connect to $config{'dataSource'}<br>$DBI::errstr";
        print "Connected successfully<br>";
    $dbh->disconnect();
    


    Some notes for CGI users
    If you do not know how to install DBI here's how (you can go to www.cpan.org and do it by hand, but this is waaaay easier).

    On your start menu there should be a ActiveState ActivePerl 5.8 > Perl Package Manager shortcut. Run it then type install dbi and it will download and install that module. When that finishes type install DBD-mysql and you are ready to go.