Using
"php": "^7.1.3",
"doctrine/doctrine-bundle": "^1.11",
"doctrine/doctrine-fixtures-bundle": "^3.1",
"doctrine/doctrine-migrations-bundle": "^2.0",
"doctrine/orm": "^2.6",
"friendsofsymfony/oauth-server-bundle": "^1.6",
"friendsofsymfony/rest-bundle": "^2.5",
"friendsofsymfony/user-bundle": "^2.1",
"jms/serializer-bundle": "^3.3",
"symfony/asset": "4.2.*",
"symfony/yaml": "4.2.*"
I cannot seem to get my configuration correct to connect my Symfony Doctrine PHP API to my MySQL database on AWS DB instance. I am running Ubuntu 16+ on all my instances. I am able to connect my local API to my local MySQL without any problems, and I am able to connect my testing server in the same way, but when I move to my production server on AWS, and I try to run the following:
php bin/console doctrine:schema:update --force --env=prod --complete
I get the following error:
In AbstractMySQLDriver.php line 93: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
I have tried multiple configuration settings and many searches, but in almost all cases the issues were with settings using localhost versus 127.0.0.1, and that is not my issue as I am trying to connect from an AWS EC2 (hosting my API) to an AWS DB instance.
I have checked multiple times and my username, database, password, and path configurations are correct, I have tested them via manual login to the DB instance.
Here is the config in my config/packages/doctrine.yaml
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8
default_table_options:
charset: utf8
collate: utf8_unicode_ci
host: 'api-database.XXXXXXXXXXX.ca-central-1.rds.amazonaws.com'
port: '3306'
dbname: 'XXXXXXX'
user: 'XXXXX'
password: 'XXXXXXXXXXXXXXXXXXXXXXX'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
monolog:
handlers:
main:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
channels: ['!event']
I should be able to connect to the database and run the migrations to update the database schema.