 |
» |
|
|
 |
|  |  |
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 RHEL5. 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 RHEL installation. The RHEL5 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. Installing MySQL |  |
Install all the MySQL components listed in Table 3 using the appropriate
version, displayed as 5.0.40-0.rhel5.<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 |
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.rhel5.x86_64.rpm Verify that the MySQL server is running by entering the
following command: # mysqladmin version 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. 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. |  |  |  |  |
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
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. For this example, change the default MySQL data directory
to a file system located on an HP SAN by following these steps: Mount the file system, which resides on the SAN, to
the /home/mysql directory. Shut down the MySQL server by entering the following
command: # /etc/init.d/mysql stop 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/ 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 |
Restart the MySQL server by entering the following
command: # /etc/init.d/mysql start Verify the changes by entering the following commands: # mysqlshow –u
root –p # mysqladmin –u
root –p version
|