'Errors creating a new database with Doctrine orm symfony
i tried creating a new data base using the command:
$ bin/console doctrine:database:create
and I got the following errors:
In ExceptionConverter.php line 91: An exception occurred in the driver: could not find driver
In Exception.php line 26: could not find driverIn Driver.php line 28: could not find driver
also i tried modifying the database url from:
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7"
to
# DATABASE_URL="mysql://root:@127.0.0.1:3306/SMF?serverVersion=5.7"
I'm using xampp server.
Solution 1:[1]
Make sure You have installed all drivers in that machine.
As far as I remember it is: php-pdo and php-pdo_mysql - depending on Your OS.
You need to have a mysql client to make such database.
Basically run this command in Your console:
symfony check:requirements
It will show You what package You are missing to run a Symfony app. Don't forget to match your MySQL Server version with DNS:
DATABASE_URL="mysql://root:@127.0.0.1:3306/SMF?serverVersion=X.Y"
And lastly, Ouss Ma L'aire Bien mentions, uncomment the DATABASE_URL You want to use and comment out all others.
Solution 2:[2]
in your case you should delete the "#" and if there are other lines staring with DATABASE_URL in your .env file just put "#" in the begining in other cases, just try your windows cmd
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Ali Nahdi |
