Q100551: Installing MySQL 8 on Red Hat/CentOS 7 or Rocky 9

Follow

SUMMARY

This article will explain the steps for a successful MySQL 8 installation on a Red Hat/CentOS 7 or Rocky 9 server, a prerequisite for your Flix setup.

 

MORE INFORMATION

The default MySQL version in Red Hat/CentOS 7 is the Mariadb version of MySQL 8. This variation of MySQL is not currently supported. You must first install the MySQL 8 repo and then the MySQL 8 server. On Rocky 9, you can skip to the MySQL 8 install step.

To install the MySQL 8 repo on Red Hat/CentOS 7, use the following command in the terminal prompt.

sudo rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

 

To install the MySQL 8 Community Server on Red Hat/CentOS 7 enter the following command in a terminal:

sudo yum install mysql-community-server --nogpgcheck

 

To install it on Rocky 9, skip the --nogpgcheck flag and you can use the default mysql-server package:

sudo yum install mysql-server

 

Once the installation is done, the server can be started by entering the following command in a terminal:

sudo service mysqld start

 

The status of the service can then be checked with the following command in a terminal:

sudo service mysqld status

 

You can configure the MySQL service to start on bootup, so if your server is restarted you don’t have to manually start it each time:

sudo chkconfig mysqld on

 

Once MySQL 8 has been installed, a root account is automatically created to access the database. On Red Hat/CentOS 7 a temporary password is set, which can be revealed by running the following command in a terminal (on Rocky 9 the password is blank and the log file doesn't exist):

sudo grep password /var/log/mysqld.log

 

If you are using Red Hat/CentOS 7, make a note of this password, you will need it to log into MySQL. To create your custom password for the database and update the security settings for MySQL you will need to run:

mysql_secure_installation

 

You can change the password to something that fits your studio password security guidelines. On Red Hat/Centos 7 MySQL requires the password to be at least 8 characters long, and have an upper and lower case letter, a number, and a special character. On Rocky 9 there aren't any password requirements.

For security reasons it is advised to remove anonymous users, Flix doesn't make use of anonymous users.

The test database is not used by Flix so you can remove it.

For the new changes to take effect you should reload the privilege table.

If you have more than a single Flix server running on the same system, do not disallow root login remotely.

If you are still having problems connecting from remote servers, you can open access manually with the following command on the MySQL server:

mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

 

UPDATING THE MySQL CONFIGURATION

You will need to update the autoinc_lock_mode to consecutive in the config file - /etc/my.cfg on Red Hat/CentOS 7 and /etc/my.cnf.d/mysql-server.cnf on Rocky 9.

innodb_autoinc_lock_mode=1

 

USING MULTIPLE FLIX SERVERS

If you use more than 2 Flix servers, you should configure the MySQL server (recommended) or the Flix servers to allow for all configured connections to take place. The default setting in MySQL is to allow 150 total connections from all Flix servers combined. The default setting for each Flix server is 70 connections to the MySQL database. Always keep an extra connection free. To update the max allowed connections in MySQL you need to update the service's config file - /etc/my.cfg on Red Hat/CentOS 7 and /etc/my.cnf.d/mysql-server.cnf on Rocky 9.

max_connections = <desired max concurrent connections>

 

If you have 3 servers each using 70 connections from each Flix server you will need to set the max_connections to at least 211. You can set it to any number higher than 211.

max_connections = 211

 

You can also adjust how many MySQL connections each Flix server creates by updating the mysql_max_connections parameters in the Flix config.yml file

mysql_max_connections: 70

  

RESTART MySQL SERVICE

After you make any changes to the MySQL configuration file, you need to restart the service from a terminal:

sudo service mysqld restart

 

 

 

FURTHER READING

You can find out how to open your firewall ports by reading this article Q100474-Opening-ports-on-your-firewall-for-Flix-communication

To learn about how to restore a Flix 6 database backup you can read this article Q100567-How-to-restore-a-Flix-6-database-backup

    We're sorry to hear that

    Please tell us why