The i5/OS POWER MySQL package was created in cooperation with IBM. MySQL works within the Portable Application Solution Environment (PASE) on the System i series of hardware and will also provide database services for the Zend Core for i5/OS.
MySQL for i5/OS is provided as a save file
(.savf
) package that can be downloaded and
installed directly without any additional installation steps
required.
MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
PASE must be installed for MySQL to operate. You must be able to
login as a user in *SECOFR
class.
You should the installation notes and tips for i5/OS before starting installation. See i5/OS Installation Notes.
The installation package will use an existing configuration if
you have previously installed MySQL (which is identified by
looking for the file /etc/my.cnf
). The
values for the data directory (DATADIR
) and
owner of the MySQL files (USRPRF
) specified
during the installation will be ignored, and the values
determined from the /etc/my.cnf
will be
used instead.
If you want to change these parameters during a new install, you
should temporarily rename /etc/my.cnf
,
install MySQL using the new parameters you want to use, and then
merge your previous /etc/my.cnf
configuration settings with the new
/etc/my.cnf
file that is created during
installation.
To install MySQL on i5/OS, follow these steps:
Create a user profile MYSQL
. The
MYSQL
user profile will own all the MySQL
files and databases and be the active user used when the MySQL
server is running. The profile should be disabled so that you
cannot log in as the MySQL user. To create a user profile, use
CRTUSRPRF:
CRTUSRPRF USRPRF(MYSQL) STATUS(*DISABLED) TEXT('MySQL user id')
On the System i machine, create a save file that will be used
to receive the downloaded installation save file. The file
should be located within the General Purpose Library
(QGPL
):
CRTSAVF FILE(QGPL/MYSQLINST)
Download the MySQL installation save file in 32-bit
(mysql-
)
or 64-bit
(5.0.42
-i5os-power-32bit.savfmysql-
)
from MySQL
Downloads.
5.0.42
-i5os-power-64bit.savf
You need to FTP the downloaded .savf
file
directly into the QGPL/MYSQLINST
file on
the System i server. You can do this through FTP using the
following steps after logging in to the System i machine:
ftp> bin
ftp> cd qgpl
ftp> put mysql-5.0.42
-i5os-power.savf mysqlinst
Log into the System i server using a user in the
*SECOFR
class, such as the
QSECOFR
user ID.
You need to restore the installation library stored in the
.savf
save file:
RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST)
You need to execute the installation command,
MYSQLINST/INSMYSQL
. You can specify three
parameter settings during installation:
DIR(
sets the installation location for the MySQL files. The
directory will be created if it does not already exist.
'/opt/mysql'
)
DATADIR(
sets the location of the directory that will be used to
store the database files and binary logs. The default
setting is '/QOpenSys/mysal/data'
)/QOpenSys/mysql/data
. Note
that if the installer detects an existing installation
(due to the existence of
/etc/my.cnf
), then this parameter
will be ignored.
USRPRF(
sets the user profile that will own the files that are
installed. The profile will be created if it does not
already exist.
MYSQL
)
MySQL can be installed anywhere, for this example we will
assume MySQL has been installed into
/opt/mysql
. The MYSQL
user profile that was created earlier in this sequence should
be used for the profile:
MYSQLINST/INSMYSQL DIR('/opt/mysql') DATADIR('/opt/mysqldata') USRPRF(MYSQL)
If you are updating an installation over an existing MySQL installation, you should use the same parameter values that were used when MySQL was originally installed.
The installation copies all the necessary files into a
directory matching the package version (for example
mysql-5.0.42-i5os-power-32bit
), sets the
ownership on those files, sets up the MySQL environment and
creates the MySQL configuration file (in
/etc/my.cnf
) completing all the steps in
a typical binary installation process automatically. If this
is a new installation of MySQL, or if the installer detects
that this is a new version (because the
/etc/my.cnf
file does not exist), then
the initial core MySQL databases will also be created during
installation.
Once the installation has completed, you can delete the installation file:
DLTLIB LIB(MYSQLINST)
To start MySQL:
Log into the System i server using a user within the
*SECOFR
class, such as the
QSECOFR
user ID.
You should start mysqld_safe using a user
that in the PASE environment has the id=0 (the equivalent of
the standard Unix root
user). If you do
not use a user with this ID then the system will be unable
to change the user when executing mysqld
as set using --user
option. If this
happens, mysqld may be unable to read the
files located within the MySQL data directory and the
execution will fail.
Enter the PASE environment using call
qp2term
.
Start the MySQL server by changing to the installation
directory and running mysqld_safe,
specifying the user name used to install the server. The
installer conveniently installs a symbolic link to the
installation directory
(mysql-5.0.42-i5os-power-32bit
) as
/opt/mysql/mysql
:
> cd /opt/mysql/mysql > bin/mysqld_safe --user=mysql &
You should see a message similar to the following:
Starting mysqld daemon with databases » from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
If you are having problems starting MySQL server, see Section 2.11.2.3, “Starting and Troubleshooting the MySQL Server”.
To stop MySQL:
Log into the System i server using the
*SECOFR
class, such as the
QSECOFR
user ID.
Enter the PASE environment using call
qp2term
.
Stop the MySQL server by changing into the installation directory and running mysqladmin, specifying the user name used to install the server:
> cd /opt/mysql/mysql > bin/mysqladmin -u root shutdown
If the session that you started and stopped MySQL are the
same, you may get the log output from
mysqld
:
STOPPING server from pid file » /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.RCHLAND.IBM.COM.pid 070718 10:34:20 mysqld ended
If the sessions used to start and stop MySQL are different, you will not receive any confirmation of the shutdown.
A problem has been identified with the installation process on
DBCS systems. If you are having problems install MySQL on a
DBCS system, you need to change your job's coded character set
identifier (CSSID
) to 37
(EBCDIC
) before executing the install
command, INSMYSQL
. To do this, determine
your existing CSSID
(using
DSPJOB
and selecting option 2), execute
CHGJOB CSSID(37)
, run
INSMYSQL
to install MySQL and then execute
CHGJOB
again with your original
CSSID.
If you want to use the Perl scripts that are included with MySQL, you need to download the iSeries Tools for Developers (5799-PTL). See http://www-03.ibm.com/servers/enable/site/porting/tools/.
User Comments
I have automated the startup process by creating a CLP and having it autostart in the ZENDCORE PHP SBS. So that when the Zend SBS is available, so is the MySQL daemon. I hope it may help.
Regards
Richard.
Senior iSeries Systems Engineer
Microlise Group Limited.
If anyone wants the source here it is:
PGM
DCL VAR(&CMD) TYPE(*CHAR) LEN(80)
DCL VAR(&PARM1) TYPE(*CHAR) LEN(20)
DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X'00')
CHGVAR VAR(&CMD) VALUE('/usr/local/mysql-5.0.37-aix5.2-powerpc-64bit/bin/mysql+
d_safe ')
CHGVAR VAR(&PARM1) VALUE(' --user=mysql &')
CHGVAR VAR(&CMD) VALUE(&CMD *TCAT &NULL)
CHGVAR VAR(&PARM1) VALUE(&PARM1 *TCAT &NULL)
PASESHELL:
CALL PGM(QP2SHELL) PARM(&CMD)
ENDPGM
Add your own comment.