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 from Generic Binaries on Unix/Linux”.

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.

  • You must have a user profile with PASE with suitable privileges. The user should be within the *SECOFR class, such as the QSECOFR user ID. You can use the WRKUSRPRF command to check your user profile.

  • For network connections to MySQL, you must have TCP/IP enabled. You should also check the following:

    • Ensure that a name has defined for the system. Run the Configure TCP/IP (CFGTCP) command and select option 12 (Change TCP/IP domain information) to display this setting. Make sure that a value is listed in the Host name field.

    • Make sure that the system has a loopback entry which represents the localhost or 127.0.0.1.

    • Ensure that the IP address of the IBM i machine is mapped correctly to the host name.

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.5.9-i5os-power-32bit.savf) or 64-bit (mysql-5.5.9-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.5.9-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.1 to 5.5). 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.1 to 5.5”.

You must specify 6 parameters to perform an upgrade:

  • DIR('/QOpenSys/usr/local/'): Sets the installation location for the MySQL files. The directory will be created if it does not already exist. This is the directory that the MySQL server will be installed into, inside a directory with a name matching the version and release. For example, if installing MySQL 5.5.9 with the DIR set to /QOpenSys/usr/local/ would result in /QOpenSys/usr/local/mysql-5.5.9-i5os-power64 and a symbolic link to this directory will be created in /QOpenSys/usr/local/mysql.

  • DATADIR('/QOpenSys/mysql/data'): Sets the location of the directory that will be upgraded.

  • 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; if it is created as part of the upgrade process, it will be disabled initially. You may wish to enable this user profile so that it can be used to start the MySQL server later. It is best practice to use the one previously created during the first installation.

  • MYSQLUSR('root user'): Any user account in the current MySQL server with SUPER privileges.

  • PASSWORD('root user password'): The password for the above account. This is necessary as the upgrade starts the MySQL server to upgrade the tables and the password is need to be able to shutdown the MySQL server.

  • CURINST('path to previous install'): The full path to the installation that is being upgraded. For example an installation in /QOpenSys/usr/local/ will be /QOpenSys/usr/local/msyql-5.5.9-i5os-power64. Failure to specify this option may result in corruption of your existing data files.

For example:

MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mysql/data') »
     USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpenSys/usr/local/mysql-5.5.9-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

  • 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/.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout