Installing and configuring MySQL 8

For orchestrated environments, we recommend installing MySQL 8 on remote database servers outside of the orchestrated environment (instead of running from inside of docker container in the orchestrated environment). Typically, MySQL will be managed by the Database Administrators (DBAs) on a pre-existing database cluster. In the event there is no DBA team to install, configure, and manage MySQL for us, follow the steps below on how to do this yourself:

Metric Insights v6.4.0 currently supports MySQL 8.0.28.

Provisioning a database server

For production environments, we recommend the following:

  • Linux server running CentOS/RHEL 7+
  • 8 cores and 32GB memory
  • Sufficient disk space for mysql data files (500GB+)
  • Linux server should have outbound access to pull mysql packages or access to internal repositories containing mysql packages

MySQL by default installs to /var/lib so make sure disk space is allocated to /var (if it's a separate volume). If this is not possible, identify which volume space has been allocated so that we can move the mysql data files there.

Installing MySQL 8

Steps to install MySQL 8 (with outbound access):

  1. Visit the MySQL Community Download Archives:
    https://downloads.mysql.com/archives/community/
  2. Select MySQL product version 8.0.28 for the appropriate Linux OS (note, images below show 8.0.21 which is also supported)

3. Choose Operating System and Operating System Version (very important that the correct OS Version is selected -- e.g. RHEL 7 vs RHEL 8, etc.):


4. Choose the RPM bundle (first result). Right click the "download" button and copy the link address

5. Use the link copied above in Step 4 to then wget the MySQL RPM package to the database server: wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar

6. Untar the MySQL RPM package from Step 5 above once it has been downloaded and saved to the database server/MySQL host: tar xvf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar

7. Once the MySQL RPM package is unpacked from Step 6, in the same directory where the MySQL tarball was just unpacked, install all of the MySQL RPMs from the tarball with the command yum localinstall *.rpm (for Ubuntu, use apt localinstall *.rpm

8. Start the mysqld service
systemctl start mysqld

9. Get the temporary root user password to access MySQL: 

grep 'temporary password' /var/log/mysqld.log

10. Initialize MySQL and go through the prompts:

mysql_secure_installation

  1. Set a new root user password
  2. Yes, remove anonymous users
  3. No, do not disallow root user login remotely
  4. Yes, remove the test database
  5. Yes, reload the privileges table 

11. Restart MySQL:
systemctl restart mysqld

12. Set MySQL to auto-start on system startup: chkconfig mysqld on

Confirm mysql access by opening the mysql prompt: mysql -u root -p

Enter the new root user password when requested.

Configuring MySQL 8

In the MySQL prompt, run the following command to remove a specific component that checks for special characters in generated passwords:

UNINSTALL COMPONENT 'file://component_validate_password';


Still in the MySQL prompt, create a new root@% user who can access the MySQL DB from any host (this is needed because the machine where Metric Insights is installed needs access to MySQL, so there has to be a user who can access MySQL from somewhere other than the MySQL localhost):

create user 'root'@'%' identified by '<enter a new root@% PW here>'; 


Once a new root@% user is created, now grant the user the necessary privileges with the command:

grant all privileges on *.* to 'root'@'%' with grant option;


Next, flush privileges:

flush privileges;


You can verify the list of grants/privileges with the command:

show grants for 'root'@'%';


The output for show grants above should look as follows:


Exit the MySQL prompt and locate /etc/my.cnf. Open this file in an editor and add the following at the very end of the file:

!includedir /etc/my.cnf.d/

Set permissions for the my.cnf.d directory to 755 and owned by root:root

Next, we need to create a mysql parameters file with custom values. This is done to optimize the mysql database for Metric Insights. Please see this KB on what parameters to set: http://kb.metricinsights.com/m/44498/l/1357280-fine-tuning-mysql-parameters-v6-2