Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Open Source Middleware Stacks Blueprint:: Database Server on HP Server Platforms with MySQL and SUSE Linux Enterprise Server Version 10

Installing and Configuring the MySQL Database

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

The MySQL Database is a robust, scalable, open-source product that provides a high-performance, low-cost, SQL-based enterprise relational database. This section describes how to install and configure the MySQL database server on HP server platforms with SLES10. Additionally, a sample database is created, and is used in all the examples in this blueprint.

NOTE: This blueprint uses the MySQL Network commercial version of the MySQL packages.

Removing the Old Version

Before you begin installing the MySQL components, verify that you have not selected the MySQL database server or client packages as part of the SLES installation. The SLES10 distribution contains an older version of MySQL that causes errors if you attempt to install another version of the MySQL software.

Use the RPM system tools to assist in removing any older versions of the MySQL software.

  1. To check the system for earlier versions of the software, enter the following command:

    # rpm -qa|grep -i mysql

  2. If an older version of the MySQL software exists, remove it by entering the following command:

    # rpm –e package_name

    NOTE: Because dependent relationships exist between RPM packages, you might encounter errors such as error: Failed dependencies. If this error message is displayed, you must first remove the dependent packages before proceeding with removal of the MySQL software.

Installing MySQL

Install all the MySQL components listed in Table 3 using the appropriate version, displayed as 5.0.40-0.sles10.<arch>.

Table 3 MySQL Components

MySQL Component

Description

MySQL-server-pro-cert

MySQL server package

MySQL-client-pro-cert

MySQL client package

MySQL-devel-pro-cert

MySQL development libraries package

MySQL-shared-pro-cert

MySQL shared libraries

MySQL-test-pro-cert

MySQL Test Suite

 

  1. Install each MySQL package by entering the following command while logged in to the target system as the root user:

    rpm –ivh package_name

    For example:

    # rpm –ivh MySQL-client-enterprise-gpl-5.0.40-0.sles10.x86_64.rpm

  2. Verify that the MySQL server is running by entering the following command:

    # mysqladmin version

  3. Enter the following commands to verify that you can retrieve information from the MySQL server:

    # mysqlshow

    # mysqlshow mysql

For more information about installing Linux RPMs, see “Installing MySQL on Linux” in the MySQL 5.0 Reference Manual, located at:

http://dev.mysql.com/doc/refman/5.0/en/linux-rpm.html

Configuring MySQL

After the MySQL installation is complete, perform the following essential configuration steps to optimize the installation.

MySQL creates a database server account named root during the installation, which is the superuser administrator account that has unlimited privileges to modify the MySQL system. By default, the root user account's password is empty. Before using MySQL, secure the default account by assigning a root password.

  1. To assign a password to the root account, enter the following command:

    # mysqladmin -u root -p password 'your_password'

    NOTE: The MySQL database maintains its own user names and passwords, distinct and separate from the Linux operating system’s users and passwords. Therefore, the MySQL root user account is not the same as the Linux system root account, and to enhance system security, should not use the same password.
  2. To specify other MySQL configurations, use a configuration file. The sample configuration files are located in the /usr/share/doc/mysql directory. Select the appropriate configuration file, based on your system's memory size, from the following list:

    • my-huge.cnf– 1GB or more of memory

    • my-innodb-heavy-4G.cnf– 4GB or more of memory, using only InnoDB tables

    • my-large.cnf– Up to 512MB of memory

  3. For the configuration examples in this document, you configure and validate both the MyISAM and InnoDB storage engines. To do this, choose the appropriate system configuration, then copy, edit, and rename the file /etc/my.cnf.

    NOTE: Storage Area Networks (SANs) provide flexibility in system management, configuration, connectivity, and performance to meet the needs of changing business environments. The HP StorageWorks SAN architecture provides open network storage solutions for all sizes and types of businesses, including small to large IT departments and enterprise environments. For more information about SAN solutions from HP, see the HP SAN Infrastructure website at:

    http://h18006.www1.hp.com/storage/saninfrastructure

  4. For this example, change the default MySQL data directory to a file system located on an HP SAN by following these steps:

    1. Mount the file system, which resides on the SAN, to the /home/mysql directory.

    2. Shut down the MySQL server by entering the following command:

      # /etc/init.d/mysql stop

    3. Move the entire data directory and all its contents to the new data directory by entering the following command:

      # mv /var/lib/mysql /home/mysql/

    4. Because the data directory was changed, you must update the /etc/my.cnf file to add the new data directory. To do this, under the [mysqld] section, change the socket= line to refer to the new data directory location, and add the datadir= line to refer to the correct path. Under the [client] section, change the socket= line to refer to the new data directory location. The sections should look similar to the following:

      [client]
      #password        = your_password
      port             = 3306
      #socket          = /var/lib/mysql/mysql.sock
      socket           = /home/mysql/mysql.sock
      [mysqld]
      datadir           = /home/mysql
      port              = 3306
      #socket           = /var/lib/mysql/mysql.sock
      socket            = /home/mysql/mysql.sock
    5. Start the MySQL server by entering the following command:

      # /etc/init.d/mysql start

    6. Verify the changes by entering the following commands:

      # mysqlshow –u root –p

      # mysqladmin –u root –p version

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2007 Hewlett-Packard Development Company, L.P.