2.10 Installing MySQL on i5/OS

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 both as a tar file and as a save file (.savf) package that can be downloaded and installed directly without any additional installation steps required. To install MySQL using the tar file, see Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”.

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.

Before Installation:

Note

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:

  1. 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) TESXT('MySQL Save file')
  2. Download the MySQL installation save file in 32-bit (mysql-5.1.73-i5os-power-32bit.savf) or 64-bit (mysql-5.1.73-i5os-power-64bit.savf) from MySQL Downloads.

  3. 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.1.73-i5os-power.savf mysqlinst
  4. Log into the System i server using a user in the *SECOFR class, such as the QSECOFR user ID.

  5. You need to restore the installation library stored in the .savf save file:

    RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJDIF(*ALL)
    Note

    You can ignore the security changes-type message at the bottom of the installation panel.

  6. Once you have finished restoring the MYSQLINST library, check that all the necessary objects for installation are on the system by using the Display Library (DSPLIB) command:

    DSPLIB LIB(MYSQLINST)
  7. You need to execute the installation command, MYSQLINST/INSMYSQL. You can specify three parameter settings during installation:

    • DIR('/QOpenSys/usr/local/mysql') sets the installation location for the MySQL files. The directory will be created if it does not already exist.

    • DATADIR('/QOpenSys/usr/local/mysql/data') sets the location of the directory that will be used to store the database files and binary logs. The default setting is /QOpenSys/usr/local/mysql/data. Note that if the installer detects an existing installation (due to the existence of /etc/my.cnf), then the existing setting will be used instead of the default.

    • USRPRF(MYSQL) sets the user profile that will own the files that are installed. The profile will be created if it does not already exist.

      Note

      You should choose an appropriate user for using the MySQL server installation. The user will be used whenever you need to do any administration on the MySQL server.

    Once you have set the appropriate parameters, you can begin the installation.

    The installation copies all the necessary files into a directory matching the DIR configuration value; 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 been completed, you will get a notice advising you to set the password for the root user. For more information, Section 2.12, “Postinstallation Setup and Testing”.

  8. Once the installation has completed, you can delete the installation file:

    DLTLIB LIB(MYSQLINST)

Upgrading an existing MySQL instance

You need to execute the upgrade command, MYSQLINST/UPGMYSQL.

Note

You cannot use MYSQLINST/UPGMYSQL to upgrade between major versions of MySQL (for example from 5.0 to 5.1). For information and advice on migrating between major versions you can use the advice provided in Section 2.13.1.1, “Upgrading from MySQL 5.0 to 5.1”.

You must specify 6 parameters to perform an upgrade:

For example:

MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mysql/data') »
     USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpenSys/usr/local/mysql-5.1.73-i5os-power64')

You should receive a Program Message indicating UPGRADE SUCCESSFUL! upon completion or an error message if there is a problem.You can view the upgrade programs progression and the error in the text file upgrade.log in the installation directory.

To start MySQL:

  1. Log into the System i server using the user profile create or specified during installation. By default, this is MYSQL.

    Note

    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.

  2. Enter the PASE environment using call qp2term.

  3. 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.12.1.3, “Starting and Troubleshooting the MySQL Server”.

To stop MySQL:

  1. Log into the System i server using the user profile create or specified during installation. By default, this is MYSQL.

  2. Enter the PASE environment using call qp2term.

  3. 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.

Note and tips