Go to main content

Oracle® Solaris Cluster Data Service for MySQL Guide

Exit Print View

Updated: October 2019
 
 

How to Install and Configure MySQL

Before You Begin

Perform this procedure to install and configure MySQL in the global cluster or in a zone cluster.


Note -  If the HA for MySQL package (ha-cluster/data-service/mysql) was not installed during your initial Oracle Solaris Cluster installation, proceed to Installing the HA for MySQL Package to install it on your cluster. Then return here to continue the installation and configuration of MySQL.
  1. Ensure that you are on the node of the global cluster or zone cluster where you have enabled your resource group.
  2. Install MySQL onto all nodes within Oracle Solaris Cluster.

    MySQL should be installed onto a cluster file system. For a discussion of the advantages and disadvantages of installing the software on local versus cluster file systems, see Determining the Location of the Application Binaries in Planning and Administering Data Services for Oracle Solaris Cluster 4.4.

    Download MySQL from http://www.mysql.com. If you intend to use local disks for the MySQL software, you will need to repeat this step on all nodes within Oracle Solaris Cluster.

  3. Create a mysql-user and mysql-group for MySQL on all nodes in the cluster that will run MySQL.

    Create an entry in /etc/group on all nodes with Oracle Solaris Cluster.

    # groupadd -g 1000 mysql

    Create an entry in /etc/passwd on all nodes within Oracle Solaris Cluster. This user should have a locked password.

    # useradd -u 1000 -g 1000 -d /global/mysql -s /bin/sh mysql
  4. Change the owner and the group for MySQL binaries.

    If MySQL binaries are on all nodes, then repeat this step on every node.

    # chown -R mysql:mysql /global/mysql
  5. Create your MySQL Database directory for your MySQL instance or instances.
    # mkdir MySQL-Database-directory

    Note -  Refer to Configuration Restrictions for a description of the MySQL Database directory and to Installing and Configuring MySQL for a list of common path names. For a multiple-master operating system scalable deployment, perform the remaining steps of this procedure on all nodes of the cluster that are about to host the MySQL database.
  6. Create the MySQL my.cnf file.

    The HA for MySQL data service provides three sample my.cnf files for MySQL. One sample configuration file is for a master configuration, one sample file is for a slave configuration, and one is for the server configuration in a MySQL cluster.

    The content of /opt/SUNWscmys/etc/my.cnf_sample_[master|slave|mysqld_cluster]provides a sample MySQL configuration file that you can use to create your MySQL instance MySQL-Database-directory/my.cnf. You must still edit that file to reflect your configuration values.

    # cp /opt/SUNWscmys/etc/my.cnf_sample_master \
    MySQL-Database-directory/my.cnf

    Note -  If you are about to configure a multiple-master or a scalable configuration, set the socket directive in the my.cnf files to socket=/tmp/physical-host.sock.
  7. Bootstrap the MySQL instance.

    This creates the privilege tables db, host, user, tables_priv, and columns_priv in the mysql database, as well as the func table.

    # cd MySQL-Base-directory
    # ./bin/mysqld --initialize --datadir=MySQL-Database-directory
  8. Create a log file directory in MySQL-Database-Directory.
    # mkdir MySQL-Database-Directory/logs
  9. Create directories for your storage engines.
    # mkdir MySQL-Database-Directory/innodb
  10. Change owner and group for MySQL-Database-Directory.
    # chown -R mysql:mysql MySQL-Database-Directory
  11. Change file permission for MySQL-Database-Directory/my.cnf.
    # chmod 644 MySQL-Database-Directory/my.cnf