Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 1.07 KB

MySQL.md

File metadata and controls

61 lines (41 loc) · 1.07 KB

Build production environment

MySQL as Database

@startuml
digraph G {
    rankdir=LR

    symfony [label="Symfony", shape=oval]
    mysql [label="MySQL", fillcolor=lightblue, style=filled, shape=cylinder]

    symfony -> mysql
}
@enduml

MySQL

Installation

Alpine

sudo apk add mysql

Debian

sudo apt install mysql-server

CentOS

sudo yum install mysql-server

Configuration

MySQL is preconfigure, and in most cases, default configurations is enough.

Symfony configuration

You need to tell symfony where to find the database. You have two options: use Environment variable, use dotenv file.

Environment variable

Edit your HTTP server configuration to add environment variable

DATABASE_URL=mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7

Dotenv configuration

At the project root create/edit the file .env.local and add the following line:

DATABASE_URL=mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7