layout | group | subgroup | title | menu_title | menu_order | version | github_link | redirect_from |
---|---|---|---|---|---|---|---|---|
default |
install_pre |
Prerequisites |
MySQL |
MySQL |
25 |
2.0 |
install-gde/prereq/mysql.md |
/guides/v1.0/install-gde/prereq/mysql.html |
- Is the Magento software installed already?
- What is the software that the Magento server needs to run?
- What operating system is my server running?
- How do I log in to my Magento server using a terminal, command prompt, or SSH?
The Magento application requires MySQL 5.6.x.
Magention versions 2.1.2 and later are compatible with MySQL 5.7.x.
Magento strongly recommends you observe the following standard when you set up your Magento database:
- Magento uses MySQL database triggers{:target="_blank"} to improve database access during reindexing. Magento does not support any custom triggers in the Magento database because custom triggers can introduce incompatibilities with future Magento versions.
- Familiarize yourself with these potential MySQL trigger limitations{:target="_blank"} before you continue.
- If you use MySQL database replication, be aware that Magento does not support MySQL statement-based replication. Make sure you use only row-based replication{:target="_blank"}.
If your web server and database server are on different hosts, perform the tasks discussed in this topic on the database server host then see Set up a remote MySQL database connection.
- Installing and configuring MySQL 5.7 on Ubuntu 16
- Installing MySQL 5.6 on Ubuntu 14
- Installing MySQL 5.6 on Ubuntu 12
This section discusses how to install MySQL 5.7 on Ubuntu 16.
The Magento application 2.1.2 and later are compatible with MySQL 5.7.
To install MySQL 5.7 on Ubuntu 16:
-
Enter the following command:
sudo apt install -y mysql-server mysql-client
-
Secure the installation.
sudo mysql_secure_installation
-
Test the installation by entering the following command:
mysql -u root -p
Sample output:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 45 Server version: 5.6.19-0ubuntu0.14.04.1 (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. mysql>
-
If you expect to import large numbers of products into Magento, you can increase the value for
max_allowed_packet
that is larger than the default, 16MB.{% include install/mysql_max-allowed-packet-ubuntu.md %}
-
Enter the following command:
apt-get -y install mysql-server-5.6 mysql-client-5.6
-
Secure the installation.
mysql_secure_installation
-
Test the installation by entering the following command:
mysql -u root -p
Sample output:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 45 Server version: 5.6.19-0ubuntu0.14.04.1 (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. mysql>
-
If you expect to import large numbers of products into Magento, you can increase the value for
max_allowed_packet
that is larger than the default, 16MB.{% include install/mysql_max-allowed-packet-ubuntu.md %}
To install MySQL 5.6 on Ubuntu 12, use the following instructions from askubuntu.com.
-
Enter the following commands in the order shown:
apt-get -y update apt-add-repository ppa:ondrej/mysql-5.6 apt-get -y update apt-get -y install mysql-server
-
Secure the installation.
mysql_secure_installation
-
Test the installation by entering the following command:
mysql -u root -p
Messages similar to the following display:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 43 Server version: 5.6.21-1+deb.sury.org~precise+1 (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. mysql>
-
If you expect to import large numbers of products into Magento, you can increase the value for
max_allowed_packet
that is larger than the default, 16MB.{% include install/mysql_max-allowed-packet-ubuntu.md %}
This section discusses how to to install MySQL 5.7 on CentOS 6 or CentOS 7.
The Magento application 2.1.2 and later are compatible with MySQL 5.7.
The following procedure is based on How to Install Latest MySQL 5.7.9 on RHEL/CentOS 7/6/5 and Fedora 23/22/21{:target="_blank"}.
As a user with root
privileges, enter the following commands in the order shown:
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum -y localinstall mysql57-community-release-el7-7.noarch.rpm
Continue with Install and configure MySQL 5.7 on CentOS 6 or 7.
The following procedure is based on How to Install Latest MySQL 5.7.9 on RHEL/CentOS 7/6/5 and Fedora 23/22/21{:target="_blank"}.
As a user with root
privileges, enter the following commands in the order shown:
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
yum -y localinstall mysql57-community-release-el6-7.noarch.rpm
Continue with the next section.
-
Enter the following commands in the order shown:
yum -y install mysql-community-server service mysqld start
-
Verify the version using the following command:
mysql --version
Sample output follows:
mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper
-
Enter the following command to get the temporary database
root
user password:grep 'temporary password' /var/log/mysqld.log
-
Enter the following command to secure the installation:
mysql_secure_installation
Follow the prompts on your screen to set a new password and configure other options.
-
Configure MySQL 5.7 as discussed in Configuring the Magento database instance.
-
CentOS 6 Install the MySQL database:
yum -y update sudo wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm && sudo rpm -ivh mysql-community-release-el6-5.noarch.rpm sudo yum -y install mysql-server
-
CentOS 7 Install the MySQL database:
yum -y update sudo wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm && sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm sudo yum -y install mysql-server
-
Start MySQL.
service mysqld start
-
Set a password for the root user and set other security-related options. Enter the following command and follow the prompts on your screen to complete the configuration.
mysql_secure_installation
-
Verify the MySQL server version.
mysql -u root -p
Messages similar to the following display:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.6.23 MySQL Community Server (GPL) Copyright (c) 2000, 2015, 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.
-
If you expect to import large numbers of products into Magento, you can configure MySQL to use the
max_allowed_packet
parameter. We recommend a value of at least 16MB.{% include install/mysql_max-allowed-packet-centos.md %}
-
Configure the Magento database instance as discussed in the next section.
To configure a MySQL database instance:
-
Log in to your database server as any user.
-
Enter the following command to get to a MySQL command prompt:
mysql -u root -p
-
Enter the MySQL
root
user's password when prompted. -
Enter the following commands in the order shown to create a database instance named
magento
with user namemagento
:create database magento; GRANT ALL ON magento.* TO magento@localhost IDENTIFIED BY 'magento';
-
Enter
exit
to quit the command prompt. -
Verify the database:
mysql -u magento -p
If the MySQL monitor displays, you created the database properly. If an error displays, repeat the preceding commands.
-
If your web server and database server are on different hosts, perform the tasks discussed in this topic on the database server host then see Set up a remote MySQL database connection.
- Set up a remote MySQL database connection
- Installing optional software
- Apache
- PHP 5.5, 5.6, or 7.0—Ubuntu
- PHP 5.5, 5.6, or 7.0—CentOS
- Configuring security options
- [How to get the Magento software]({{ page.baseurl }}install-gde/bk-install-guide.html)