Installing MySQL 5.7 in Ubuntu 20.04 and configuring for Bitrix

22.02.2022 | 847 | SQL

Installing the recommended 1C-Bitrix version of the MySQL 5.7 DBMS on Linux Ubuntu OS version 20.04 LTS and setting the optimal settings

Download and install the package to select the DBMS version:
sudo apt update sudo apt install wget -y wget https://dev.mysql.com/get/mysql-apt-config_0.8.16-1_all.deb sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
Next, select the following options:
Ubuntu Bionic MySQL Server & Cluster mysql-5.7 OK
Updating the repository cache:
sudo apt-get update
We look at the availability of the version of packages in the cache:
sudo apt-cache policy mysql-server
Installing version 5.7:
sudo apt install mysql-client=5.7* mysql-server=5.7* mysql-common=5.7*
Launching the installer:
sudo mysql_secure_installation
We definitely answer no to the first question (otherwise the password policy will get you):
Would you like to setup VALIDATE PASSWORD plugin? N
Add the update of installed packages to the block (specify exactly your version of packages):
sudo nano /etc/apt/preferences.d/mysql
Package: mysql-server Pin: version 5.7.36-1ubuntu18.04 Pin-Priority: 1001  Package: mysql-client Pin: version 5.7.36-1ubuntu18.04 Pin-Priority: 1001  Package: mysql-community-server Pin: version 5.7.36-1ubuntu18.04 Pin-Priority: 1001  Package: mysql-common Pin: version 5.7.36-1ubuntu18.04 Pin-Priority: 1001  Package: mysql-community-client Pin: version 5.7.36-1ubuntu18.04 Pin-Priority: 1001  Package: mysql-apt-config Pin: version 0.8.10-1 Pin-Priority: 1001
We add the optimal bitrix settings for me to the end of the file (I recommend in the future to look at tips for tuning settings in bitrix on the page "/bitrix/admin/perfmon_db_server.php?lang=ru"):
nano /etc/mysql/mysql.conf.d/mysqld.cnf
sql_mode = "" performance-schema = false table_open_cache = 1024 thread_cache_size = 4 query_cache_size = 32M query_cache_type = 1 tmp_table_size = 128M max_heap_table_size = 128M innodb_file_per_table = 0 innodb_buffer_pool_size = 1024M innodb_flush_log_at_trx_commit = 2 innodb_buffer_pool_instances = 2 innodb_flush_method = O_DIRECT transaction-isolation = READ-COMMITTED key_buffer_size = 16M
Restarting the DBMS:
systemctl restart mysql.service
Creating a database and a user:
CREATE DATABASE base_name; CREATE USER 'base_name'@'localhost' IDENTIFIED WITH mysql_native_password BY 'base_password'; GRANT ALL ON base_name.* TO 'base_name'@'localhost'; FLUSH PRIVILEGES;



← Back

Comments (0)