MySQL Tips: Debugging a MySQL Installation on OpenVMS

Some very quick notes on installing and configuring and starting MySQL on an OpenVMS server follow.

First, thanks to JFP here for the MySQL port and the kits.

If you recall nothing else from this article, remember to copy over the run_mysqld.com_template file for a new installation of MySQL on OpenVMS.

This is a fully-privileged user context with all privileges lit, and the target disk is ODS-5, and some commands and symbols (eg: UAF, unzip) are presumed here. This sequence is from an OpenVMS Alpha V8.3 system, though the sequence is nearly identical for any recent OpenVMS I64 environment.

The DCL installation commands used, some command and representative MySQL errors and other such are included in the following; this was the DCL sequence used to install and launch MySQL.


$ unzip MYSQL051-V2301-0-1.ZIP
Archive:  XDELTA$DKA0:[HOFFMAN]MYSQL051-V2301-0-1.ZIP;2
  inflating: jfp-axpvms-mysql051-v2301-0-1.pcsi  
$ dir jfp*

Directory XDELTA$DKA0:[HOFFMAN]

JFP-AXPVMS-MYSQL051-V2301-0-1.PCSI;1    JFP-AXPVMS-ZLIB-V0102-3-1.PCSI;1

Total of 2 files.
$ product install mysql051
%PCSI-I-CANNOTVAL, cannot validate XDELTA$DKA0:[HOFFMAN]JFP-AXPVMS-MYSQL051-V2301-0-1.PCSI;1
-PCSI-I-NOTSIGNED, product kit is not signed and therefore has no manifest file
 
The following product has been selected:
    JFP AXPVMS MYSQL051 V23.1-0            Layered Product
 
Do you want to continue? [YES] 
 
Configuration phase starting ...
 
You will be asked to choose options, if any, for each selected product and for
any products that may be installed to satisfy software dependency requirements.
 
JFP AXPVMS MYSQL051 V23.1-0: MYSQL051
 
* This product does not have any configuration options.
 
Execution phase starting ...

The following product will be installed to destination:
    JFP AXPVMS MYSQL051 V23.1-0            DISK$ALPHASYS:[VMS$COMMON.]
 
Portion done: 0%...10%...20%...30%...60%...70%...80%...90%...100%

The following product has been installed:
    JFP AXPVMS MYSQL051 V23.1-0            Layered Product
$

The files involved with this release are installed in the sys$common:[mysql051...] directory.

Getting the startup going is fairly straightforward, once you realize there's a template file that's missing.

For whatever reason, there are no specific errors issued here when the configuration is not as expected; if you should forget a prerequisite step, the MySQL startup can be unforgiving.


$ @SYS$COMMON:[MYSQL051.VMS.MYSQL]start_mysqld.com 
Job start_mysqld (queue SYS$BATCH, entry 1) started on SYS$BATCH
$ mysql
%DCL-W-IVVERB, unrecognized command verb - check validity and spelling
 \MYSQL\
$ @SYS$COMMON:[MYSQL051.VMS]mysql_startup.com;
Job start_mysqld (queue SYS$BATCH, entry 2) started on SYS$BATCH
$ @SYS$COMMON:[MYSQL051.VMS]logicals     
$ @SYS$COMMON:[MYSQL051.VMS]symbols 
$ mysql
%DCL-W-ACTIMAGE, error activating image LIBZ_SHR32
-CLI-E-IMAGEFNF, image file not found XDELTA$DKB500:[SYS0.SYSCOMMON.MYSQL051.][VMS.LIB]LIBZ_SHR32.EXE;
$ unzip  LIBBZ2-V0100-4-1.ZIP
Archive:  XDELTA$DKA0:[HOFFMAN]LIBBZ2-V0100-4-1.ZIP;1
  inflating: jfp-axpvms-libbz2-v0100-4-1.pcsi  
$ prod insta libbz2
%PCSI-I-CANNOTVAL, cannot validate XDELTA$DKA0:[HOFFMAN]JFP-AXPVMS-LIBBZ2-V0100-4-1.PCSI;1
-PCSI-I-NOTSIGNED, product kit is not signed and therefore has no manifest file
 
The following product has been selected:
    JFP AXPVMS LIBBZ2 V1.0-4               Layered Product
 
Do you want to continue? [YES] 
 
Configuration phase starting ...
 
You will be asked to choose options, if any, for each selected product and for
any products that may be installed to satisfy software dependency requirements.
 
JFP AXPVMS LIBBZ2 V1.0-4: LIBBZ2
 
* This product does not have any configuration options.
 
Execution phase starting ...

The following product will be installed to destination:
    JFP AXPVMS LIBBZ2 V1.0-4               DISK$ALPHASYS:[VMS$COMMON.]
 
Portion done: 0%...30%...60%...70%...80%...100%

The following product has been installed:
    JFP AXPVMS LIBBZ2 V1.0-4               Layered Product
$ mysql
%DCL-W-ACTIMAGE, error activating image LIBZ_SHR32
-CLI-E-IMAGEFNF, image file not found XDELTA$DKB500:[SYS0.SYSCOMMON.MYSQL051.][VMS.LIB]LIBZ_SHR32.EXE;
$ dir XDELTA$DKB500:[SYS0.SYSCOMMON.libz]*.com

Directory XDELTA$DKB500:[SYS0.SYSCOMMON.LIBZ]

startup.com;1       

Total of 1 file.
$ @XDELTA$DKB500:[SYS0.SYSCOMMON.LIBZ]startup
$ mysql

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)

$ @SYS$SYSROOT:[MYSQL051.VMS.MYSQL]FIRST_START_MYSQLD
Job first_start_mysqld (queue SYS$BATCH, entry 3) started on SYS$BATCH
Waiting for database initialization to complete
Waiting for database initialization to complete

 …^Y Interrupt …

$ @SYS$COMMON:[MYSQL051.VMS]LOGICALS "/SYSTEM/EXEC"
$ @SYS$SYSROOT:[MYSQL051.VMS.MYSQL]FIRST_START_MYSQLD
Job first_start_mysqld (queue SYS$BATCH, entry 4) started on SYS$BATCH
Waiting for database initialization to complete
Database initialization done, please review:
  mysql051_root:[mysql_server]mysqld.log
$ mysql

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)
$ @SYS$SYSROOT:[MYSQL051.VMS]mysql_startup.com       
Job start_mysqld (queue SYS$BATCH, entry 5) started on SYS$BATCH
$ mysql

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)
$ MYSQLADMIN -u USER -p PASSWORD
Enter password: 

xdelta$dkb500:[sys0.syscommon.mysql051.][vms.bin]mysqladmin.exe;1: connect to server at 'localhost' failed error: 'Can't connect to MySQL server on 'localhost' (61)'

Check that mysqld is running on localhost and that the port is 3306.
You can check this by doing 'telnet localhost 3306'
$ telnet localhost 3306
%TELNET-I-TRYING, Trying ... 127.0.0.1
%TELNET-E-CONNFAIL, Failed to connect to remote host
-SYSTEM-F-REJECT, connect to network object rejected

Nope; not working. Back to the startup file.


$ set default sys$sysroot:[mysql051.vms]
$ @[.MYSQL]FIRST_START_MYSQLD
Job first_start_mysqld (queue SYS$BATCH, entry 6) started on SYS$BATCH
Waiting for database initialization to complete
Database initialization done, please review:
  mysql051_root:[mysql_server]mysqld.log

$ @SYS$COMMON:[MYSQL051.VMS.MYSQL]first_run_mysqld.com;1 
ERROR: 1007  Can't create database 'mysql'; database exists
090315 12:09:28 [ERROR] Aborting

090315 12:09:28 [Note] /XDELTA$DKB500/SYS0/SYSCOMMON/MYSQL051/VMS/bin/mysqld.exe: Shutdown complete

%DCL-W-SKPDAT, image data (records not beginning with "$") ignored
090315 12:09:35  InnoDB: Started; log sequence number 0 46409
090315 12:09:35  InnoDB: Starting shutdown...
090315 12:09:37  InnoDB: Shutdown completed; log sequence number 0 46409
$ @SYS$COMMON:[MYSQL051.VMS.MYSQL]start_mysqld.com   
Job start_mysqld (queue SYS$BATCH, entry 7) started on SYS$BATCH
$ mysql

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)
$ @mysql_startup.com
Job start_mysqld (queue SYS$BATCH, entry 8) started on SYS$BATCH
$ mysql

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)

MySQL error 2003 indicates the MySQL server daemon (still) isn't running, or that the server daemon isn't chatting with the network. (Or less likely with localhost or such, that there's a firewall or other such block here.)

Given there are log files typically created, a look at the log files seems in order. A check of the MySQL startup procedure that submits the startup batch job shows the daemon entries are running under another username, which means the batch logs will typically be located in another directory and not in a directory associated with the current submit context.

Checking the UAF entry for the username associated with daemon.

This to determine where logs and such are written.


$ uaf
UAF> sho mysql*

Username: MYSQL051_SRV                     Owner:  
Account:  MYSQL051                         UIC:    [37776,1] ([MYSQL051,MYSQL051_SRV])
CLI:      DCL                              Tables: DCLTABLES
Default:  MYSQL051_ROOT:[MYSQL_SERVER]
LGICMD:   MYSQL051_ROOT:[VMS.MYSQL]LOGIN_SERVER.COM
Flags:  DisCtlY DefCLI LockPwd Restricted DisWelcome DisNewMail DisMail
              DisReport DisReconnect
Primary days:   Mon Tue Wed Thu Fri        
Secondary days:                     Sat Sun
Primary   000000000011111111112222  Secondary 000000000011111111112222
…

The log file gets written here: MYSQL051_ROOT:[MYSQL_SERVER]start_mysqld.LOG

The problem (oops) is a template file that's not been instantiated either by the installation or manually after the installation.

Here's that file:


$ type MYSQL051_ROOT:[VMS.MYSQL]run_mysqld.com_template;
$ set process/parse=extend
$ mysqld :== $ mysql051_root:[vms.bin]mysqld
$ define sys$scratch mysql051_root:[mysql_server.tmp]
$ define /noLOG TMPDIR "/mysql051_root/mysql_server/tmp"
$ define /noLOG DECC$EFS_CASE_PRESERVE enable
$ define /noLOG DECC$EFS_CHARSET enable
$ define /noLOG DECC$READDIR_DROPDOTNOTYPE enable
$ define /noLOG DECC$FILENAME_UNIX_REPORT enable
$ define /noLOG DECC$FILE_SHARING enable
$ define /noLOG DECC$EFS_CASE_SPECIAL disable
$ define /noLOG DECC$FILENAME_UNIX_ONLY enable
$ define /noLOG DECC$ALLOW_REMOVE_OPEN_FILES enable
$ define /noLOG TCPIP$SELECT_ABORT_ON_SIGNAL enable
$ define /noLOG DECC$FD_LOCKING enable
$ define /noLOG DECC$POSIX_SEEK_STREAM_FILE enable
$ set rms/ext=20000
$ if f$trnlnm("LIBZ_SHR32") .eqs. "" then $ define LIBZ_SHR32 -
                mysql051_root:[vms.lib]libz_shr32.exe
$ if f$trnlnm("LIBZ_SHR64") .eqs. "" then $ define LIBZ_SHR64 -
                mysql051_root:[vms.lib]libz_shr64.exe
$!
$! All options except ansi defined using configuration file my.cnf
$!
$ mysqld  --ansi
$ if f$search ("mysql051_root:[mysql_server.tmp]*.*;*") .nes. ""
$ then
$      delete mysql051_root:[mysql_server.tmp]*.*;*
$ endif

So what does the startup look like?


$ type sys$sysroot:[mysql051...]start_mysqld.com
 
SYS$COMMON:[MYSQL051.VMS.MYSQL]start_mysqld.com;1
 
$ proc = f$environment("PROCEDURE")
$ if f$edit(f$getjpi("","username"),"compress") .nes. "MYSQL051_SRV"
$ then
$   queue = "SYS$BATCH"
$   if P1 .nes. "" then $ queue = P1
$   submit/user=mysql051_srv/noprint/queue='queue' 'proc'
$ else
$   run /detach -
        /input=mysql051_root:[vms.mysql]run_mysqld.com -
        /out=mysqld.log -
        /err=mysqld.err -
        /authorize -
        /priority=4 -
        /process_name=mysql051_server -
        /priv=(nosame,netmbx,tmpmbx) -
        sys$system:loginout.exe 
$   write sys$output "mysql daemon started..."
$ endif
$ exit

And what does the template file contain?


$ type MYSQL051_ROOT:[VMS.MYSQL]run_mysqld.com_template;
$ set process/parse=extend
$ mysqld :== $ mysql051_root:[vms.bin]mysqld
$ define sys$scratch mysql051_root:[mysql_server.tmp]
$ define /noLOG TMPDIR "/mysql051_root/mysql_server/tmp"
$ define /noLOG DECC$EFS_CASE_PRESERVE enable
$ define /noLOG DECC$EFS_CHARSET enable
$ define /noLOG DECC$READDIR_DROPDOTNOTYPE enable
$ define /noLOG DECC$FILENAME_UNIX_REPORT enable
$ define /noLOG DECC$FILE_SHARING enable
$ define /noLOG DECC$EFS_CASE_SPECIAL disable
$ define /noLOG DECC$FILENAME_UNIX_ONLY enable
$ define /noLOG DECC$ALLOW_REMOVE_OPEN_FILES enable
$ define /noLOG TCPIP$SELECT_ABORT_ON_SIGNAL enable
$ define /noLOG DECC$FD_LOCKING enable
$ define /noLOG DECC$POSIX_SEEK_STREAM_FILE enable
$ set rms/ext=20000
$ if f$trnlnm("LIBZ_SHR32") .eqs. "" then $ define LIBZ_SHR32 -
                mysql051_root:[vms.lib]libz_shr32.exe
$ if f$trnlnm("LIBZ_SHR64") .eqs. "" then $ define LIBZ_SHR64 -
                mysql051_root:[vms.lib]libz_shr64.exe
$!
$! All options except ansi defined using configuration file my.cnf
$!
$ mysqld  --ansi
$ if f$search ("mysql051_root:[mysql_server.tmp]*.*;*") .nes. ""
$ then
$      delete mysql051_root:[mysql_server.tmp]*.*;*
$ endif

And here's the statement that resolves the MySQL startup problem here; we had forgotten to copy over the template.


$ copy MYSQL051_ROOT:[VMS.MYSQL]run_mysqld.com_template MYSQL051_ROOT:[VMS.MYSQL]run_mysqld.com
$ @mysql_startup.com
Job start_mysqld (queue SYS$BATCH, entry 10) started on SYS$BATCH
$ telnet localhost 3306
%TELNET-I-TRYING, Trying ... 127.0.0.1
%TELNET-I-SESSION, Session 01, host localhost, port 3306
7TELNET-I-ESCAPE, Escape character is ^]
 5.1.23-rc}1x+jXV*,iUPnZY/{CxW(
telnet> quit

Do remember to add the two startup command procedure invocations above into SYSTARTUP_VMS.COM.

And you're done.

RTFM, like always

I think this article is unfair: the installation doc states clearly to copy the template, in

http://www.vmsmysql.org/DownloadAndInstallationMySQL5122

Extract

Configure the MySQL package to suit your environment by editing the file MYSQL051_ROOT:[VMS]my.cnf and MYSQL051_ROOT:[VMS.MYSQL]run_mysqld.com

$ copy my.cnf_template my.cnf/prot=w:re
$ edit my.cnf
...
$ copy [.mysql]run_mysqld.com_template [.mysql]run_mysqld.com/prot=w:re
$ edit [.mysql]run_mysqld.com
...

If I try to install Oracle 10g on VMS without reading the doc, without having JAVA installed and started (OUI, Oracle Universal Installer needs JAVA and is used to install Oracle on any platform), without applying the mandatory patches, without having an ODS-5 device... it will fail miserably.

By the way, if you want to contribute, send an improved procedure to JFP.

Just my 2 cents of Euro.

"RTFM" is an implicit admission of UI failure

That's a good point and a reasonable approach for various software packages. As I recall when I went after this MySQL installation some eight months ago, I went looking for directions and instructions and found only some notes posted, and found various conflicting sequences and some documentation that was very clearly outdated. Which led me to post some of my notes.

If you wish to take umbrage from my posting of my notes and experiences and my mistakes in public, stick around. I'm sure to post more. And I'm sure to make more mistakes.

If you wish to glean suggestions for enhancements from my postings, stick around. Within this MySQL posting and with the testing services discussed here (in a fashion), there are obvious enhancements. Use of the PCSI “template” keyword on the templates and/or detection of missing files and associated error messages, and using expected filenames in expected directory places and/or a configuration tool could all be potential outcomes here. Embedding the documentation in the kit, too.

If you wish to point to the poor quality of enterprise software as an appropriate software design model, well, that's your choice. I prefer to see these cases as limitations and to see these fixed (or to fix it), and to (try to) prevent the user from screwing up. (eg: users and spam, users and passwords)

Resorting to the classic software engineering “RTFM solution” is a balance between the cost of not doing something (or of documenting your way out of the corner that your design or your code has left you in) with the costs and time and distractions involved in supporting the folks that slam into the corner cases.

To be clear, there are cases a product team or a port can't feasibly or can't reasonably solve. That you can and will resort to the “RTFM solution”. Cases that just won't arise often. Or that are really gnarly to solve. But when dragging out the “RTFM solution”, the product folks will think about what that means in some detail.

My probable approach within MySQL would be to rewrite various parts of the DCL and the PCSI kit and to redesign the installation and configuration environment, and that level of change might or might not be accepted back into JFP's port or into the upstream MySQL environment. And which also requires vastly more of an investment than posting my notes and my mistakes here. That's the fun of all this; there's just way too much stuff to work on. (I have no idea how JFP manages to port over as much code as has been ported, but that's another discussion.)

That MySQL and related are not part of OpenVMS is another discussion; Bill Pedersen has been commenting on this in various forums, and I've certainly posted similar comments.