- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
01-Text | 1.85 MB |
Contents
Installing the required software packages
Copying the installation programs to the Linux server
Customizing MySQL file directories
Starting and stopping the MySQL service
Creating a remote root user account
Configuring MySQL configuration files
Configuring the maximum number of connections
Configuring case-insensitive table names
Setting the max_allowed_packet size
Changing the log and database file directory
(Optional.) Configuring the transaction isolation level
Overview
This document describes how to install and configure the MySQL 5.5 database for use with IMC. The procedures also apply to MySQL 5.1. Perform all procedures in this document as a Linux root user, unless otherwise specified.
The installation procedures for the MySQL server for other versions might vary. For more information about installing other versions, see their respective installation and configuration guides.
IMPORTANT: Before you install IMC, you must install and start the database service. |
Prerequisites
Before you install MySQL on Red Hat Enterprise Linux 7.3, install necessary Linux packages and remove the built-in MariaDB.
Installing the required software packages
1. Prepare the following Linux packages:
¡ glibc-2.17-157.el7.i686.rpm
¡ libaio-0.3.109-13.el7.i686.rpm
¡ libgcc-4.8.5-11.el7.i686.rpm
¡ libstdc++-4.8.5-11.el7.i686.rpm
¡ nss-softokn-freebl-3.16.2.3-14.4.el7.i686.rpm
2. Install the packages, as shown in Figure 1.
rpm –i –-nodeps –-force glibc-2.17-157.el7.i686.rpm
rpm –i –-nodeps –-force libaio-0.3.109-13.el7.i686.rpm
rpm –i –-nodeps –-force libgcc-4.8.5-11.el7.i686.rpm
rpm –i --nodeps –-force libstdc++-4.8.5-11.el7.i686.rpm
rpm -i --nodeps –-force nss-softokn-freebl-3.16.2.3-14.4.el7.i686.rpm
Figure 1 Installing the packages
Removing the built-in MariaDB
Before you install the MySQL 5.5 database, you must remove the built-in MariaDB from Red Hat Enterprise Linux 7.3, as shown in Figure 2.
1. Query the installed MariaDB and related programs.
rpm –qa | grep mariadb
2. Remove the software packages.
rpm –e mariadb-server-5.5.52-1.el7.x86_64
rpm –e mariadb-5.5.52-1.el7.x86_64
rpm –e mariadb-libs-5.5.52-1.el7.x86_64
3. Remove the dependent packages if you receive a mariadb-server-5.5.52-1.el7.x86_64 and rpm –e mariadb-libs-5.5.52-1.el7.x86_64 package dependency message.
rpm –e -–nodeps mariadb-server-5.5.52-1.el7.x86_64
rpm –e -–nodeps mariadb-5.5.52-1.el7.x86_64
rpm –e -–nodeps mariadb-libs-5.5.52-1.el7.x86_64
Figure 2 Removing the built-in MariaDB
4. Query the installed MySQL database and related programs.
rpm –qa | grep mysql
rpm –qa | grep MySQL
Figure 3 Querying the installed MySQL database
5. Remove the software packages.
rpm –e --nodeps qt-mysql-4.8.5-13.el7.x86_64
rpm –e --nodeps akonadi-mysql-1.9.2-4.el8.x86_64
rpm –e –nodeps perl –DBD-MySQL-4.023-5.el7.x86_64
Figure 4 Removing the software packages
Copying the installation programs to the Linux server
Before you install the MySQL server, copy the installation programs to the Linux server. This document uses the MySQL-server-5.5.62-1.el7.x86_64.rpm and MySQL-client-5.5.62-1.el7.x86_64.rpm installation programs shown in Figure 5. In this example, the MySQL installation programs are located in the directory /mysql.
Figure 5 MySQL installation programs on the Linux operating system
|
NOTE: · Install both MySQL-server-5.5.62-1.el7.x86_64.rpm and MySQL-client-5.5.62-1.el7.x86_64.rpm on the database server. · Install only MySQL-client-5.5.62-1.el7.x86_64.rpm on the IMC server that uses a remote database. During IMC installation, select other server for the database location, and then enter the server address. |
Installation
In the following procedures, root user refers to the MySQL database root user, not the Linux root user, unless specified otherwise.
Installing the MySQL server
1. Go to the directory where the MySQL installation programs are located.
2. Launch the MySQL server installation, as shown in Figure 6.
Figure 6 Installing the MySQL server
3. Start the MySQL service after the installation is complete.
service mysql start
4. Verify that the MySQL service has started, as shown in Figure 7.
netstat –nat | grep 3306
By default, the MySQL server uses port number 3306.
Figure 7 Checking the MySQL service status
Installing the MySQL client
The MySQL client provides tools for MySQL management and user interaction, for example, mysqladmin and mysql.
To install the MySQL client:
1. Go to the directory where the MySQL installation programs are located.
2. Launch the MySQL client installation, as shown in Figure 8.
Figure 8 Installing the MySQL client
3. Verify the installation.
¡ If the MySQL server is installed on the local server, log in to the server by using the mysql command. Figure 9 shows that the MySQL client is installed successfully.
Figure 9 Entering the mysql command
¡ If the MySQL server is installed on a remote server, verify that the client can connect to the MySQL server, as shown in Figure 10. Make sure the MySQL server contains your root user account. For information about how to create a remote root user account, see "Creating a remote root user account."
Figure 10 Verifying the connection to the MySQL server
The output shows that 192.168.7.187 is the IP address of the MySQL server, and root is the root user account.
The mysql prompt indicates that the client has connected successfully to the MySQL server.
Customizing MySQL file directories
After the MySQL server and client are installed, the database files, configuration files, and command files are saved in different directories, as described in Table 1.
Table 1 Default MySQL file directories
Connector |
|
/usr/bin |
Client programs and scripts |
/usr/sbin |
mysqld (MySQL service program) |
/var/lib/mysql |
Logs and database files |
/usr/share/mysql |
Configuration files, error messages, and character set files |
/etc/init.d/ |
Enables script mysql |
/etc |
my.cnf |
To customize the directories, modify the datadir parameter in the /etc/my.cnf file.
datadir=/root/mysql_data
The total size of logs and database files can become large. It is restricted by the maximum size allowed by the operating system. You can change the directory to a disk drive with a large capacity. For more information about changing the directories for the MySQL database files, see "Changing the log and database file directory."
Startup and stop
Starting and stopping the MySQL service
MySQL is configured automatically as a system service after the MySQL server is installed.
You can start or stop the MySQL service as a common system service, as shown in Figure 11.
Figure 11 Start and stop commands
You can also use the mysqladmin command to stop the MySQL server, as shown in Figure 12.
You must enter the password for your root user account except for the initial installation. If you are installing the MySQL server for the first time, press Enter without entering a password.
Automatic startup
The MySQL service starts automatically when the system boots. Figure 13 shows how to determine whether the MySQL service is on the automatic startup list.
Figure 13 Determining whether the MySQL service is on the automatic startup list
The output shows that the MySQL service starts automatically in Linux run levels 2 through 5. Table 2 describes the run levels.
Run level |
Name |
Description |
0 |
Halt |
Shuts down the system. |
1 |
Single-user Mode |
Mode for administrative tasks. |
2 |
Multi-user Mode |
Does not configure network interfaces and does not export network services. |
3 |
Multi-user Mode with Networking |
Starts the system normally. |
4 |
Not used/User-definable |
For special purposes. |
5 |
Start the system normally with appropriate display manager (with GUI) |
Starts the system normally with display manager. |
6 |
Reboot |
Reboots the system. |
Configuring the MySQL server
Disable the MySQL service before you perform any MySQL server configuration tasks except for "Setting security options" and "Creating a remote root user account."
Setting security options
Run the mysql_secure_installation program to set security options, such as setting a root user password, as shown in Figure 14, and removing anonymous users or the test database, as shown in Figure 15.
In the following procedures, the root user refers to the MySQL database root user, not the Linux root user.
Figure 14 Setting the root user password
IMPORTANT: For IMC to correctly identify the root
user password during installation, ensure that the password does not contain
spaces, tabs (\t), or any of the following characters: |
Figure 15 Configuring anonymous users, remote root access, and the test database
The output shows that remote root access is disabled. For information about configuring the remote root user, see "Creating a remote root user account."
The privilege tables are reloaded, as shown in Figure 16.
Figure 16 Reloading the privilege tables
Creating a remote root user account
To create a remote root user account:
1. Log in to MySQL.
mysql -uroot -piMC123
2. Create a remote root user account on the MySQL server.
grant all privileges on *.* to root@'%' identified by 'iMC123' with grant option;
In Figure 17, the first iMC123 string is the password for the root user, and the second iMC123 string is the password for the remote root user. You can change the password for the remote root user.
Figure 17 Creating a remote root user account
IMPORTANT: For IMC to correctly identify the password during installation, ensure that the password does not contain spaces, tabs (\t), or any of the following characters: ` ' " ! ( ) & | \ $ ; @ < > / ^ |
Configuring MySQL configuration files
At startup, MySQL server uses the default configuration file /etc/my.cnf, which determines the performance and behavior of the MySQL server. The file is not generated automatically. Select the proper settings from /usr/share/mysql. The my-huge.cnf file is required to support IMC. Copy the file, and then save it to the my.cnf file, as shown in Figure 18.
Figure 18 Copying the my-huge.cnf file to my.cnf
Configuring the maximum number of connections
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add the max_connections parameter under [mysqld]. If this parameter already exists, modify the value as needed.
[mysqld]
max_connections=800
You can set the maximum number of connections according to the installed modules. For more information about the maximum number of connections for different IMC modules, see HP IMC Getting Started Guide.
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
6. Start the MySQL service.
Configuring the character set
The English character set is latin1.
To configure the character set:
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode and modify the parameters.
¡ Add the default-character-set parameter under [mysql] and set the value to latin1. If the parameter already exists, change the value to latin1.
¡ Add the character-set-server parameter under [mysqld]. If this parameter already exists, you can change the value.
vi /etc/my.cnf
[mysqld]
character-set-server=latin1
The latin1 character set is used as an example. To prevent garbled characters from appearing in IMC, choose the character set for your operating system language. If you change the character set after IMC has been deployed, you must reinstall IMC.
3. Press Esc to exit edit mode.
4. Save the file, and then exit the vi editor.
:wq
Configuring the engine type
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add the default-storage-engine parameter under [mysqld]. If this parameter already exists, you can change the value.
vi /etc/my.cnf
[mysqld]
default-storage-engine = INNODB
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
Configuring case-insensitive table names
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add the lower_case_table_names parameter under [mysqld]. If this parameter already exists, you can change the value.
vi /etc/my.cnf
[mysqld]
lower_case_table_names=1
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
Disabling log-bin settings
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Search the log-bin parameter under [mysqld]. If this parameter already exists, comment it out.
vi /etc/my.cnf
[mysqld]
#log-bin=mysql-bin
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
Setting innodb buffer sizes
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add the innodb_buffer_pool_size and innodb_additional_mem_pool_size parameters under [mysqld]. If the parameters already exist, you can change the values.
[mysqld]
innodb_buffer_pool_size=512M
innodb_additional_mem_pool_size=20M
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
Setting the max_allowed_packet size
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add the max_allowed_packet parameter under [mysqld]. If the parameter already exists, you can change the value.
[mysqld]
max_allowed_packet = 200M
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
Setting the default-time-zone
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add the default-time-zone parameter. If the parameter already exists, modify its value as needed.
[mysqldump]
default-time-zone = '+8:00'
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
Backing up the database
When you use the mysqldump program to back up the database, the backup progress might be slow and cause data backlog. No data or not much data will be available during the database backup period. To resolve the issue, modify the my.cnf file as follows:
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add the mysqldump parameter.
[mysqldump]
Single-transaction
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
Changing the log and database file directory
1. Stop the MySQL service.
service mysql stop
2. Create a storage path for logs and database files. In this example, the path is /data/mysql_data.
mkdir –p /data/mysql_data
3. Copy all files from the default directory to the new directory, and then change ownership of the files.
cp –a –R /var/lib/mysql/* /data/mysql_data/
chown –R mysql:mysql /data/mysql_data
4. Add the directory in the configuration file of the MySQL database.
vi /etc/my.cnf
[mysqld]
datadir=/data/mysql_data
5. Restart the system, and then enable the MySQL service.
service mysql start
(Optional.) Configuring the transaction isolation level
When installing EIA, access the /etc/my.cnf file and check whether the transaction_isolation parameter exists under [mysqld]. If that parameter does not exist, add it. If that parameter exists, modify it:
1. Open the my.cnf file in vi editor.
vi /etc/my.cnf
2. Enter i to enter edit mode.
3. Add or modify the transaction_isolation parameter under [mysqld].
[mysqld]
transaction_isolation=READ-COMMITTED
4. Press Esc to exit edit mode.
5. Save the file, and then exit the vi editor.
:wq
6. Restart the MySQL service.
service mysql start
Uninstallation
1. Uninstall the MySQL server and client, as shown in Figure 19.
Figure 19 Uninstalling the MySQL server and client
2. Check the component names, as shown in Figure 20.
Figure 20 Checking MySQL components
3. Manually remove the database files after uninstallation. By default, the database files are saved in /var/lib/mysql. Use the rm –rf command to remove the mysql directory.
FAQ
Why do garbled characters appear in the database table?
During the installation of the MySQL server and client, configure a database character set that matches the operating system language. If they do not match, garbled characters might appear in the database table.
If you use an English operating system, set the character set to latin1. If your operating system language is different, see the related MySQL documentation for the correct character set.
How do I update the database passwords for IMC?
If the password of the account that IMC uses to connect to a database is changed, the IMC server will fail to connect to the database. To resolve this problem, modify the database user password saved in IMC:
1. Execute the /opt/iMC/deploy/instInfoMgr.sh –modify dbAdminPwd=yourpassword command to modify the database password on the IMC server. For example, change the password to iMC123456, as shown in Figure 21.
Figure 21 Changing the database password on the IMC server
2. Click the Environment tab in the Intelligent Deployment Monitoring Agent window, and then click Refresh in the Database Space Usage area.