Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
📙 You will learn
How to install and configure MySQL on CentOS.
Prerequisites
Audience: IT Professional and/or End User
Difficulty: Intermediate
Time needed: Approximately 60 minutes
Tools required:
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 5.7 at the following location.)
Download MySQL Yum Repository |
---|
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm |
Install the MySQL Yum Repository:
Install MySQL Yum Repository |
---|
sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm |
Install MySQL server:
Install MySQL Server |
---|
sudo yum install mysql-server |
Options for Large Data Sets
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):
innodb_buffer_pool_size=12G tmp_table_size=6G max_heap_table_size=6G |
Restart the server for the changes to take effect.
You can confirm the changes afterward with the following query (unit=GB):
select @@innodb_buffer_pool_size/POWER(1024,3) AS INNODB_BUFFER_POOL_SIZE,@@tmp_table_size/POWER(1024,3) AS TMP_TABLE_SIZE,@@max_heap_table_size/POWER(1024,3) AS MAX_HEAP_TABLE_SIZE; |
Start MySQL
Start & enable the MySQL daemon:
Start MySQL Daemon |
---|
sudo systemctl start mysqld sudo systemctl enable mysqld |
Verify successful start:
Install MySQL Server |
---|
sudo systemctl status mysqld |
The output should contain Active: active (running)
, and the last line should end with Started MySQL Server
.
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 |
---|
$ sudo grep 'temporary password' /var/log/mysqld.log
Output Output: 2018-01-24T00:22:31.416107Z 1 [Note] A temporary password is generated for root@localhost: mqRfBU_3Xk>r |
Run the following security script:
MySQL Security Script |
---|
sudo mysql_secure_installation |
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.
Start up the MySQL command-line-interface by running the following:
MySQL CLI |
---|
mysql -u root -p |
Use the new root password you created in the previous step.
Create ThreadFix Database and Accounts
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:
CREATE DATABASE threadfix CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; |
Create user accounts by using the following commands:
Create & Grant ThreadFix Accounts |
---|
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; |
Info |
---|
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
Table of Contents | ||
---|---|---|
|
https://threadfix.it/ | www.denimgroup.com
© Copyright 2020 Denim Group, LTD. All Rights Reserved.