How to Install & Configure MySQL 5.7 in Ubuntu 16?

In this particular article we’ll learn to install & configure Magento MySQL version 5.7 in Ubuntu 16 or later. To do so, please follow the below mentioned steps:

Magento MySQL version 5.7 on Ubuntu 16 – Install

  • First enter the following command using command prompt.

sudo apt install -y mysql-server mysql-client

  • Next we’ll make sure the installation by inputting the following commands.

sudo mysql_secure_installation

  • Thirdly we’ll check the installation status. To do so use the below command mentioned following:  

mysql -u root -p

  • Next we’ll see similar output for the test command inserted earlier.
Welcome to the MySQL monitor.  Commands end with; or \g.

Your MySQL connection id is 45

Server version: 5.7.0-0ubuntu0.16.0.0 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 


As per our requirement we can also edit the limit max_allowed_packet (default 16 MB) in any size. Basically the max_allowed_packet is related to the number of Mage products inserted.  

Magento MySQL version 5.7 on Ubuntu 16 – Configure

  • Further to insert a greater value, go to >> /etc/mysql/mysql.cnf.
  • Next download and open the file with a text editor.
  • Now under the opened file look for the value is named as max_allowed_packet.
  • Then increase the number of MB as required (16, 32, 64 or greater MB) depending on number of products in Mage store.
  • Further save the changes and close text editor.
  • To complete the setup restart Magento MySQL version: service mysql restart.
  • Finally we can also the check the value by entering the following by using the command prompt.

SHOW VARIABLES LIKE 'max_allowed_packet';

For more related articles read:

Magento MySQL configuration for remote connection – Part 2

Magento MySQL configuration for remote connection – Part 3