MySQL installation and configuration
Installation
Warning Make sure to install a supported version of MySQL Server and ODBC Connector. |
If you have already installed and configured MySQL, proceed to Configuration.
1.Before installing the database on Linux, add MySQL repository:
Debian, Ubuntu |
Run the following commands in the Terminal: a)wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb b)sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb See also: Adding the MySQL APT Repository |
CentOS, Red Hat, Fedora |
|
OpenSuse, SUSE Linux Enterprise Server |
2.After adding the MySQL repository update your local repository cache (e.g. on Debian run sudo apt-get update), and you can proceed with MySQL installation.
3.Installation of MySQL differs depending on the Linux distribution and version used:
Linux distribution: |
MySQL Server installation command: |
MySQL Server advanced installation: |
Debian, Ubuntu |
sudo apt-get install mysql-server |
https://dev.mysql.com/doc/refman/5.7/en/linux-installation-apt-repo.html |
CentOS, Red Hat, Fedora |
sudo yum install mysql-server |
https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html |
OpenSuse, SUSE Linux Enterprise Server |
sudo zypper install mysql-community-server |
https://dev.mysql.com/doc/refman/5.7/en/linux-installation-sles-repo.html |
•Manual installation – download and install MySQL Community Server edition from: https://dev.mysql.com/downloads/mysql/
Configuration
1.Run the following command to openss the my.cnf (my.ini for Windows installation) file in a text editor:
sudo nano /etc/mysql/my.cnf
If the file is not present, try /etc/my.cnf or /etc/my.cnf.d/community-mysql-server.cnf
2.Find the following configuration in the [mysqld] section of the my.cnf file and modify the values. If the parameters are not present in the file, add them to the [mysqld] section:
max_allowed_packet=33M
•For MySQL 8 you have to set the following variable:
olog_bin_trust_function_creators=1
oAlternatively, you can disable binary logging: log_bin=0
•For MySQL 5.6.20 and 5.6.21 (you can determine your MySQL version by using mysql --version):
oinnodb_log_file_size needs to be set to at least 200 MB (for example, innodb_log_file_size=200M), but not more than 3000 MB
•For MySQL 5.6.22 and supported later versions (including version 8):
oinnodb_log_file_size*innodb_log_files_in_group needs to be set to at least 200 MB (* denotes multiplication, the product of the two parameters must be > 200 MB. The minimal value for innodb_log_files_in_group is 2 and maximum value is 100, the value also has to be integer).
For example:
innodb_log_file_size=100M
innodb_log_files_in_group=2
3.Save and close the file and enter the following command to restart the MySQL server and apply the configuration (in some cases, the service name is mysqld):
sudo service mysql restart
4.Run the following command to set up MySQL including privileges and password (this is optional and may not work for some Linux distributions):
/usr/bin/mysql_secure_installation
5.Enter the following command to check whether the MySQL server is running:
sudo service mysql status