I keep getting this problem everytime i try to migrate using the commandline: php bin/console make:migration
or even doctrine:migration status
when i try the doctrine:migration:sync-metadata-storage
as they tell me I still get the same error message.
I'm currently learning symfony and have been following a guide but I get this problem somehow Symfony 4.4 php 7.2
Try changing the DATABASE_URL in .env from
DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=10.4.11
to
DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=mariadb-10.4.11
Symfony documentation suggest specifying the version number but not the database type
"There are more options in config/packages/doctrine.yaml that you can configure, including your server_version (e.g. 5.7 if you're using MySQL 5.7), which may affect how Doctrine functions." https://symfony.com/doc/current/doctrine.html
Original Answer: https://github.com/doctrine/DoctrineMigrationsBundle/issues/337#issuecomment-645390496
For MariaDB you will need the full semver compat version: Major.Minor.Patch. By executing mysql --version
, you will get the correct version you are currently running.
For me was enough prefixing the server version with mariadb-x.x.x. It fixed the issue.
"If you are running a MariaDB database, you should prefix the serverVersion with mariadb- (ex: mariadb-10.2.12)."
https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
It works if I change the DATABASE_URL
in .env
From:
DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=10.4.11
To:
DATABASE_URL=mysql://root:@127.0.0.1:3306/testtest?serverVersion=mariadb-10.4.11
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With