Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated instructions for installing MySQL 5.7
Image RemovedImage Added

📙 You will learn

How to install and configure MySQL on CentOS.

Prerequisites

Audience: IT Professional and/or End User
Difficulty: (blue star) Intermediate
Time needed:(blue star) Approximately 60 minutes
Tools required: N/A

Install MySQL (Highly Recommended)

Info

ThreadFix currently supports MySQL versions 5.6 and 5.7. It is not yet compatible with version 8.

Download the MySQL 5.7 Yum repository:

(Even though the repository available at https://dev.mysql.com/downloads/repo/yum/ is newer and defaults to installing version 8, you can still download install 5.7 at the following locationas follows.)

Download MySQL Yum Repository

wget

1. Enable the MySQL 5.7 Yum repository:

Code Block
sudo rpm --import https://
dev
repo.mysql.com/
get/mysql57
RPM-
community
GPG-
release
KEY-
el7-11.noarch.rpm

Install the MySQL Yum Repository:

Install MySQL Yum Repository

sudo rpm -ivh
mysql-2022
sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

2. Install MySQL server:

Install MySQL Server
Code Block
sudo yum install mysql-community-server

Options for Large Data Sets

1. To help the MySQL server to work with large data sets, we recommend allocating more than the 8GB of memory stated in our hardware requirements for the DB server.

Additionally, edit the my.cnf file (e.g., /etc/my.cnf), adding the following lines under the "[mysqld]" header (or editing the existing values, if already present):

Code Block
innodb_buffer_pool_size=12G

tmp_table_size=6G

max_heap_table_size=6G
max_allowed_packet=1G

2. Restart the server for the changes to take effect.

You can confirm the changes afterward with the following query (unit=GB):

Code Block
languagesql
select CONCAT(@@innodb_buffer_pool_size/POWER(1024,3),'G') AS INNODB_BUFFER_POOL_SIZE,CONCAT(@@tmp_table_size/POWER(1024,3),'G') AS TMP_TABLE_SIZE,CONCAT(@@max_heap_table_size/POWER(1024,3),'G') AS MAX_HEAP_TABLE_SIZE,CONCAT(@@max_allowed_packet/POWER(1024,3),'G') AS MAX_ALLOWED_PACKET;

Start MySQL

1. Start & enable the MySQL daemon:

Start MySQL Daemon
Code Block
sudo systemctl start mysqld

sudo systemctl enable mysqld

2. Verify successful start:

Install MySQL Server
Code Block
sudo systemctl status mysqld

The output should contain Active: active (running), and the last line should end with Started MySQL Server.

3. To start the MySQL command-line-interface, you'll need the temporary password generated for the MySQL root user, which you can find in /var/log/mysqld.log.

Example search and output:
Temporary MySQL Root User Password

Code Block
$ sudo grep 'temporary password' /var/log/mysqld.log

 


 
Output:

2018-01-24T00:22:31.416107Z 1 [Note] A temporary password is generated for root@localhost: mqRfBU_3Xk>r

4. Run the following security script:
MySQL Security Script

Code Block
sudo mysql_secure_installation

5. Enter the default root password obtained in the previous step and enter & re-enter a new password when prompted.

You'll then be asked if you want to change the root password (again)...press ENTER to decline and step through the remaining prompts...we recommend choosing Yes for removing anonymous users and for reloading the privilege tables at the end.

6. Start up the MySQL command-line-interface by running the following:
MySQL CLI

Code Block
mysql -u root -p

Use the new root password you created in the previous step.

Create ThreadFix Database and Accounts

1. Update MySQL Character Set and Create the threadfix database:

  • MySQL does not, by default, support the full Unicode character set. ThreadFix requires the MySQL character set to be updated to utf8mb4. Running the following command will create the threadfix database and set the correct encoding:

Code Block
CREATE DATABASE threadfix CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

2. Create user accounts by using the following commands:
Create & Grant ThreadFix Accounts:

Code Block
CREATE USER 'threadfix'@'localhost' IDENTIFIED BY 'tfpass';

CREATE USER 'threadfix'@'%' IDENTIFIED BY 'tfpass';

GRANT ALL PRIVILEGES ON threadfix.* TO 'threadfix'@'localhost' IDENTIFIED BY 'tfpass';

GRANT ALL PRIVILEGES ON threadfix.* TO 'threadfix'@'%' IDENTIFIED BY 'tfpass';

FLUSH PRIVILEGES;
Infonote

Change 'threadfix' and 'tfpass' to a more secure username and password

More information on creating users and their permissions in MySQL can be found here.

After you have finished creating a new user, or at any time, use the EXIT command to exit the MySQL command-line-interface.

ThreadFix Installation

Now that you've completed the CentOS Enterprise Setup and MySQL Installation and Configuration, proceed to the ThreadFix Installation page.

Table of

content

Contents

Table of Contents
excludeTable of content
https://threadfix.it/ | www.denimgroup.com
© Copyright 2020 Denim Group, LTD. All Rights Reserved.