Search code examples
mysqlfirebasegoogle-cloud-platformtypeorm

socketPath equivalent for mySQL connection in TypeORM


I created a mySQL database in the google cloud and I'm trying to connect to the mySQL instance from firebase according to this question on stackoverflow we need to set the socketPath property of mySql connection but TypeORM hasn't the same property wondering is there any other alternative?


Solution

  • What you are looking for lives in "extra" in your ormconfig. Here's an example that connects up to cloud SQL successfully for me:

    {
    "type": "mysql",
    "extra": {
        "socketPath": "/cloudsql/<project>:<region>:<database>"
        },
    "port": 3306,
    "username": "myuser",
    "password": "secret",
    "database": "mydb"
    }