The current version of Shopware 6.4 officially supports MySQL and MariaDB. That said, it’s not compatible with a lot of minor and bugfix releases from the last one and a half years. Although the underlying doctrine/dbal
package has been updated to work with current MySQL >= 8.0.20 in July 2020 it hasn’t made its way to the Shopware core yet.
This is actually a problem, because the highest supported version of MySQL (Version 8.0.19) has no release for Ubuntu 20.04 or 21.04. Instead you’re forced to use Ubuntu 19.04.
So your options are 1) downgrading to MySQL 5.7, which I would not recommended since its implementation for some of the data types Shopware uses is rather slow.
2) Install MySQL with deb packages on Ubuntu 19.04 or you can 3) decide to use MariaDB, again with version limitations. Like with MySQL, Shopware expects specific versions of MariaDB On Ubuntu for example, installing MariaDB gives you a bleeding edge version (v10.5.13), which is, again, unsupported by Shopware.
Before downgrading Ubuntu, I switched to CentOS, in order to see which versions are installed out of the box. And in fact on CentOS you get a MariaDB version supported by Shopware by default. Also, the way CentOS can lock a certain package to a specific version is easy as well.
MariaDB 10.3.28 on CentOS
Here’s the procedure of Installing MariaDB on CentOS:
# allow installs of epel packages
sudo yum -y install epel-release
sudo yum install nano htop
yum update
yum upgrade
# disable native appstream repos to prevent conflicts
dnf module disable mysql mariadb
Now we can tell CentOS that it ought to stick to version 10.3.28 of MAriaDB. Therefor prevent accidental upgrades in the future. Create the following file:
/etc/yum.repos.d/MariaDB.repo[mariadb] name = MariaDB-10.3.28 baseurl=http://yum.mariadb.org/10.3.28/centos8-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Now we get the packages GPG key, install and enable MariaDB like so:
sudo rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB # get GPG Key
sudo yum clean all
sudo yum install mariadb-server
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
/usr/bin/mysql_secure_installation
After that, you can connect to your DB Server, create databases, users and grant privileges.
MySQL 8.0.19 on Ubuntu 19.04
Alternatively, the steps to install MySQL 8.0.19 on Ubuntu 19.04 are as follows. You may also want to read the documentation on installation of MySQL .deb packages.
First we download the required packages:
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-core_8.0.19-1ubuntu18.04_amd64.deb
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-core_8.0.19-1ubuntu18.04_amd64.deb
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client_8.0.19-1ubuntu18.04_amd64.deb
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-client_8.0.19-1ubuntu18.04_amd64.deb
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server_8.0.19-1ubuntu18.04_amd64.deb
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_8.0.19-1ubuntu18.04_amd64.deb
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-common_8.0.19-1ubuntu18.04_amd64.deb
Then we install them with:
sudo dpkg -i mysql-community-client-core_8.0.19-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-server-core_8.0.19-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-client_8.0.19-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-client_8.0.19-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-server_8.0.19-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-server_8.0.19-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-common_8.0.19-1ubuntu18.04_amd64.deb
And finally, you want to lock the version. This step is necessary to prevent an accidental update to a newer version of MySQL. So, in order to being able to run apt update && apt upgrade
again, without upgrading MySQL accidentally you need to lock the version in.
apt-mark hold mysql-client
apt-mark hold mysql-community-client
apt-mark hold mysql-community-client-core
apt-mark hold mysql-community-server
apt-mark hold mysql-community-server-core
apt-mark hold mysql-server
apt-mark hold mysql-common
After this, you can apt upgrade and the installed version of MySQL will still be 8.0.19.
Now you should be ready to create databases, users, and grant privileges.