Configuring the Database Server
  • Updated on 22 Nov 2019
  • 1 minute to read
  • Print
  • Share
  • Dark
    Light

Configuring the Database Server

  • Print
  • Share
  • Dark
    Light

This article describes how you can change your database server.

Spryker offers support for using MySQL or PostgreSQL as database servers. By default, the virtual machine is configured to use the PostgreSQL database server, but you can easily change it so that it uses the MySQL database server.

To configure the database server you want to use, you have to keep in mind these constants and use them in the corresponding configuration file:

Database Server ZED_DB_ENGINE ZED_DB_PORT
MySQL ZED_DB_ENGINE_MYSQL 3306
PostgreSQL ZED_DB_ENGINE_PGSQL 5432

The configuration files are placed under the config/Shared/ folder.

E.g.: config/Shared/config_default-development.php is the configuration file for the development environment.

Using MySQL as a DB Server

 <?php

$config[PropelConstants::ZED_DB_ENGINE] = $config[PropelConstants::ZED_DB_ENGINE_MYSQL];
$config[PropelConstants::ZED_DB_PORT] = 3306;

Using PostgreSQL as a DB Server

<?php

$config[PropelConstants::ZED_DB_ENGINE] = $config[PropelConstants::ZED_DB_ENGINE_PGSQL];
$config[PropelConstants::ZED_DB_PORT] = 5432;

Creating the Database

To create or update the database configuration, run the installation tool using this command:

vendor/bin/install

If the application is already installed on your virtual machine and you switch to a different database server, you can also run:

vendor/bin/install

Use the -h option to see the help page for this command.

Was this article helpful?