Issue
- You need to run MySQL 5 in Linux for ESET Inspect On-Prem
- Install MySQL 5
- Set up the MySQL database
- Verify the MySQL service status
- Sources
Solution
Install MySQL 5
-
In the terminal, run the following commands:
sudo apt-get update sudo apt-get upgrade sudo apt-get install mysql-server-5.7 -
Install MySQL Workbench, which is the database GUI (Graphical User Interface). In the terminal, run:
sudo apt install mysql-workbench
Set up the MySQL database
-
In the terminal, run the following command to open the MySQL command line client:
sudo mysql -u root -pIf prompted, type your MySQL root password. You should now see
mysql>within the terminal, indicating that you are inside the MySQL command line client. Everything you type now is an SQL command, not a regular terminal command. -
Set up the database user account for localhost and external connections. Run the following SQL commands in the MySQL command line client:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin'; CREATE USER 'root'@'%' IDENTIFIED BY 'admin'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;The commands update the password for the local root user account (
root'@'localhost, created by default during MySQL installation) toadmin, and create a remote-accessible root user account (root'@'%) with the same password (admin) and full privileges. You can replace the placeholder passwordadminin the commands with a secure password of your choice. -
Verify that both the local and remote root user accounts are configured. Run:
SELECT Host, User FROM mysql.user WHERE User='root';You should see entries for
'root'@'%'and'root'@'localhost', confirming that the user accounts are correctly configured.You can exit the MySQL command line client by running:
exit;After exiting, you should no longer see
mysql>in the terminal. -
After the user accounts are configured, set up the MySQL database. In the terminal, run:
mysql_secure_installationWhen prompted, answer the questions as follows:
VALIDATE PASSWORD PLUGIN [Y/n] n Change the password for root? [Y/n] n Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y -
Copy the
mysql.servicefile. In the terminal, run:sudo cp /lib/systemd/system/mysql.service /etc/systemd/system/ -
Open the
/etc/systemd/system/mysql.servicefile in a text editor and add the following lines:LimitNOFILE=30000 LimitMEMLOCK=30000To open the file from the terminal, run:
sudo nano /etc/systemd/system/mysql.service -
Save the file and reload the system configuration. In the terminal, run:
sudo systemctl daemon-reload -
Open the
/etc/mysql/mysql.conf.d/mysqld.cnffile in a text editor and update it as specified below.To open the file from the terminal, run:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf- Under the
[mysqld]section, update the following parameters:
bind-address = {IP_OF_THIS_MACHINE} thread_stack = 256KReplace
{IP_OF_THIS_MACHINE}inbind-addresswith the IP address of the machine where the MySQL database is running. Do not use the default value127.0.0.1. (localhost), as this allows only local connections. ESET Inspect On-Prem will not be able to connect to the MySQL database if the IP address is incorrect. - Under the
[mysqld]section, add the following parameters:
innodb_buffer_pool_size=4G innodb_flush_log_at_trx_commit=0 innodb_log_file_size=2GThe values for
innodb_buffer_pool_sizeandinnodb_log_file_sizeare examples. Setinnodb_buffer_pool_sizeto 80% of the MySQL server machine's available RAM. Setinnodb_log_file_sizeto 40-60% of theinnodb_buffer_pool_sizevalue. -
At the end of the file, add the following lines:
event_scheduler = ON wait_timeout=900 max_connections=300
- Under the
-
Restart MySQL to load the new parameters. In the terminal, run:
sudo service mysql restart
Verify the MySQL service status
In the terminal, run:
systemctl status mysql.service
The MySQL service is running when Active: active (running) is indicated.