MySQL 8 on Linux System
Open the Terminal and run the following commands:
sudo apt-get update |
sudo apt-get upgrade |
sudo apt-get install mysql-server |
To install MySQL Workbench (optional), which is the GUI for the database:
sudo apt install mysql-workbench |
Database setup
You need to set the database user for localhost and external connections and push the following SQL commands or via the cmd line.
Cmd line (not Workbench):
sudo mysql -u root -p |
create user 'root'@'%' IDENTIFIED BY 'root'; |
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'admin.1'; |
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin.1'; |
grant all privileges on *.* to 'root'@'%' with grant option; |
From the mysql.user menu, select host %, and user root.
After the user is added and defined, you can set up the MySQL database.
mysql_secure_installation |
Validate password component [Y/n] n |
Change the root password? [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 |
We recommend changing the password, as "admin.1" is the default. This password is required during ESET Inspect Server Installation. Through the terminal, follow the tutorial.
Through the Workbench, click:
•Database > Connect to Database… select database > OK
•Then Server > Users and Privileges > Select root%—set the password and confirm it
Open the Terminal and execute the following command to copy mysql.service file:
sudo cp /lib/systemd/system/mysql.service /etc/systemd/system/ |
Open the /etc/systemd/system/mysql.service in texteditor (or nano, pico, vi ...) and add following lines:
sudo nano /etc/systemd/system/mysql.service |
LimitNOFILE=30000 |
LimitMEMLOCK=30000 |
Save the file and reload the system configuration by the following command:
sudo systemctl daemon-reload |
Now you need to modify /etc/mysql/mysql.conf.d/mysqld.cnf file (where are the db params).
Open the mysqld.cnf file in texteditor or nano, pico, vi ... and add the following lines under section [mysqld]:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf |
bind-address = xxx.xxx.xxx.xxx |
innodb_flush_log_at_trx_commit=0 |
innodb_buffer_pool_size=2G |
innodb_redo_log_capacity=2G |
thread_stack=256K |
disable-log-bin |
local_infile = 1 |
wait_timeout=900 |
max_connections=300 |
*bind-address—default value is 127.0.0.1. Set this address to the machine's IP where MySQL is running. If the incorrect IP address is used, ESET Inspect On-Prem Installation cannot connect to MySQL.
*innodb_buffer_pool_size—set to 80% of the RAM size of MySQL machine
*innodb_log_file_size—set to 40% - 60% of the innodb_buffer_pool_size value
Restart MySQL to load the new parameters:
sudo service mysql restart |
Verify the status of the MySQL Service
Open the terminal, and type in the command.
systemctl status mysql.service |
MySQL Service is running when the reported state is: active (running).
Sources
MySQL Installation |
https://www.cyberciti.biz/faq/howto-install-mysql-on-ubuntu-linux-16-04/ |
---|---|
Warning: World-writable config file '/etc/mysql/my.cnf' is ignored |
https://stackoverflow.com/questions/32133353/unable-to-connect-to-mysql-database-in-ubuntu |
Open_files_limit |
|
MySQL command line commands |
https://dev.mysql.com/doc/refman/5.5/en/getting-information.html |