How to install MySQL as as server on your own (Windows) machine, install a local copy of the database, and get Gleam running without a network connection: 

(Disclaimer: I did all this as a rank novice, so there are probably better ways to do some of these things. But I think they will all work.)

1) Download the binary from www.mysql.com/downloads.  You want mysql 3.23.56 (was in April 2003, anyway)

2) Unzip the file into a temporary directory.

3) Run setup.exe; install into the default directory (usually c:\mysql). Add c:\mysql\bin, for example, your path.

4) Write a file called my.cnf (using notepad, for example) containing the following lines:

[mysqld]
basedir=c:/mysql
datadir=c:/mysql/data

and put it in the root directory of your boot drive (c: in our case)

5) Install the server service, and start it:

cd c:\mysql\bin
>mysqld --install
>NET Start MySQL

(I believe that the server will restart at each subsequent boot.)

6) Try it out. You need a password, which you can get from Joanne Bogart or Leon Rochester:

>mysql -u glastreader -h centaurusa.slac.stanford.edu -p calib
Enter password: ***********
mysql> ...

See http://www.slac.stanford.edu/exp/glast/ground/software/calibration/docs/mysqlDirect.shtml for some examples.

7) Import the calibration database: 

"Dump" the database from the central server. I think to do this you need to be logged on to our server, which is centaurusa.slac.stanford.edu. Once logged on, the correct command seems to be:

>mysqldump -u glastreader --opt calib -p > mydumpfile.sql
Enter password: ************

(We will eventually have this dumpfile on the glast ftp server.) 

Move the file to your machine (ftp, mounted disk, whatever; it's an ascii file) and read it back:

>mysql -u root
mysql> create database calib;
mysql> \q
mysql calib < mydumpfile.sql
mysql> use calib
Database changed
mysql> show tables;
+-----------------+
| Tables_in_calib |
+-----------------+
| junk |
| metadata_v0 |
| metadata_v1 |
| metadata_v2 |
| metadata_v2r1 |
+-----------------+
5 rows in set (0.00 sec)

8) Set up users and passwords:

In order for Gleam to work, you need a glastreader user. Set it up as follows:

> mysql -u root

mysql> grant usage on *.* to glastreader@localhost identified by 'glastpassword';
mysql> grant select on calib.* to glastreader@localhost identified by 'glastpassword';
        (and maybe...)
mysql> grant usage on *.* to glastreader@"%" identified by 'glastpassword';
mysql> grant select on calib.* to glastreader@"%" identified by 'glastpassword';
mysql> select host, user, password from mysql.user;
+-----------+-------------+------------------+
| host      | user        | password         |
+-----------+-------------+------------------+
| localhost | root        |                  |
| %         | root        |                  |
| localhost |             |                  |
| %         |             |                  |
| %         | glastreader | xxxxxxxxxxxxxxxx |
| localhost | glastreader | xxxxxxxxxxxxxxxx |

+-----------+-------------+------------------+
6 rows in set (0.00 sec)

'xxxx...' is the encrypted form of the password you just typed in... Actually, it's not 'xxxx...' but I x'ed it out so you wouldn't see it. It's what MySQL uses to check the plaintext password. The password 'glastpassword' is the same one that you got from Leon or Joanne, above.

You also want to protect your 'root' user with a password:

mysql>set password for root@localhost = password('mynewpassword');
Query OK...
mysql> set password for root@"%" = password('mynewpassword');
Query OK...
mysql> select host, user, password from mysql.user;
+-----------+-------------+------------------+
| host      | user        | password         |
+-----------+-------------+------------------+
| localhost | root        | xxxxxxxxxxxxxxxx |
| %         | root        | xxxxxxxxxxxxxxxx |
| localhost |             |                  |
| %         |             |                  |
| %         | glastreader | xxxxxxxxxxxxxxxx |
| localhost | glastreader | xxxxxxxxxxxxxxxx |
+-----------+-------------+------------------+
6 rows in set (0.00 sec)

The "password('mynewpassword')" is very important... it does the encryption. If you leave it out,

mysql> set password for root@"%" = 'mynewpassword';
ok...

it doesn't get encrypted, and MySQL won't recognize it when you try to login.

Finally, if you see a blank user, you should get rid of it:

mysql%gt delete from mysql.user where host='localhost' and user="";
Query OK...
mysql%gt delete from mysql.user where host="&" and user="";
Query OK...
mysql> select host, user, password from mysql.user;
+-----------+-------------+------------------+
| host      | user        | password         |
+-----------+-------------+------------------+
| localhost | root        | 4e6064b31f46ea95 |
| %         | root        | 4e6064b31f46ea95 |
| %         | glastreader | 03559aa07ca50006 |
| localhost | glastreader | 03559aa07ca50006 |
+-----------+-------------+------------------+
4 rows in set (0.00 sec)

That's better!

9) Copy enough calibration files to satisfy Gleam: 

Not a problem for now, since all the necessary files are in cvs, hence in calibUtil.

10) Modify the requirements file in calibUtil to point to the local database. (This will be handled from the jobOptions file eventually.):

set MYSQL_HOST localhost
set MYSQL_METATABLE metadata_v2r1

10) Push the button!


Leon Rochester; last significant modification, 24 April 2003