MySQL installation and configuration

Installation

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

Adding the MySQL APT Repository

CentOS, Red Hat, Fedora

Adding the MySQL Yum Repository

OpenSuse, SUSE Linux Enterprise Server

Adding the MySQL SLES Repository

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.

2.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 open 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 on Linux 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 later:

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 netstat -tap | grep mysql

If the MySQL server is running, the following line will be displayed. Note that the process identifier - PID (7668 in the example below) may be different:

tcp   0   0 localhost:mysql    *:*         LISTEN    7668/mysqld