0

How can i use symfony 3 with mariadb?

But i want to use doctrine also but i did not see any useful information on http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#sqlanywhere

So please guide or provide proper article link thanks.

Ricky ponting
  • 4,537
  • 4
  • 13
  • 26
  • try dump($this->getDoctrine()->getConnection()); and look and the private property platform. what class is it? – Brucie Alpha Aug 26 '17 at 21:40
  • 1
    Dude, configuration for mariadb is exactly the same as for the mysql – Mike Doe Aug 27 '17 at 07:35
  • [MariaDB is a binary drop in replacement for MySQL](https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/), just like Percona. However each database platform has their own technical specifications and limitations. ie. MariaDB JSON support is a TEXT field, where MySQL would be JSON. MariaDB will tranlate most MySQL specific function calls automatically to be compatible with how MariaDB functions. – Will B. Apr 21 '18 at 02:02

4 Answers4

11

If you get doctrine:schema:update to show the same migrations again and again, consider adding this to your config:

doctrine:
    dbal:
        server_version: 'mariadb-X.X.X'

Replacing X.X.X with the real version of mariadb installed on the executing machine.

jav974
  • 1,022
  • 10
  • 22
  • Just an extra information: GitHub discussion about the mariadb prefix for the server version: https://github.com/doctrine/dbal/issues/2985#issuecomment-378595588 – Michon Oct 10 '20 at 11:48
1

The mysql-client package also works with MariaDB server. You can see the Version Details here. https://mariadb.com/kb/en/the-mariadb-library/mariadb-vs-mysql-compatibility/

Cesur APAYDIN
  • 806
  • 3
  • 11
  • 24
0

HI its similar to mysql configuration

parameters.yml

parameters:
    database_host: 127.0.0.1
    database_port: null
    database_name: test # your database name
    database_user: root # mysql username
    database_password: test123 # mysql password

In your config.yml

doctrine:
    dbal:
        driver: pdo_mysql
        host: '%database_host%'
        port: '%database_port%'
        dbname: '%database_name%'
        user: '%database_user%'
        password: '%database_password%'
        charset: UTF8
Robert
  • 3,373
  • 1
  • 18
  • 34
0

In my case it was the port change, 3307, check the port in MariaDB:

parameters:
    database_host: 127.0.0.1
    database_port: 3307
    database_name: test # your database name
    database_user: root # mysql username
    database_password: test123 # mysql password
Alex S
  • 4,726
  • 7
  • 39
  • 67