title: NestJs TypeORM unable to connect to mysql
body: <p>I am trying to connect to MySQL. I have defined the db connection vars in a .env file in my root dir, and I am initializing the connection in the <code>app.module.ts</code> file.
  the only issue I am facing now is when creating or running migrations using the CLI,
  I followed the typeorm docs <a href="https://typeorm.io/#/migrations/creating-a-new-migration" rel="noreferrer">here</a> to configure the connection, however when I run   <code>typeorm migrate:create -n myNewTable</code>, it should create the migration file in the specified directory, what it does instead is it creates it in the app root directory,
  similarily, I solved the issue by using the <code>-d</code> flag after the <code>typeorm migrate:create</code> to specify the directory, however when I try running my migration files, I get this</p>
  
  <blockquote>
    <p>No connection options were found in any of configurations file.</p>
  </blockquote>
  
  <p>here is my app.module.ts file.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>TypeOrmModule.forRoot({
        type: 'mysql',
        host: process.env.TYPEORM_HOST,
        port: parseInt(process.env.TYPEORM_PORT, 10),
        username: process.env.TYPEORM_USERNAME,
        password: process.env.TYPEORM_PASSWORD,
        database: process.env.TYPEORM_DATABASE,
        synchronize: false,
        migrations: [process.env.TYPEORM_MIGRATIONS],
        cli: {
          migrationsDir: process.env.TYPEORM_MIGRATIONS_DIR,
        },
        logging: (process.env.TYPEORM_LOGGING === 'true') ? true : false,
        entities: [__dirname + '/../**/*.entity{.ts,.js}'],
      }),
   </code></pre>
  </div>
  </div>
  </p>
  
  <p>and here is my .env file </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code># use .ts for development, .js for production
  TYPEORM_CONNECTION = mysql
  TYPEORM_HOST = 127.0.0.1
  TYPEORM_PORT = 3306
  TYPEORM_USERNAME = &lt;username&gt;
  TYPEORM_PASSWORD = &lt;password&gt;
  TYPEORM_DATABASE = &lt;dbname&gt;
  TYPEORM_SYNCHRONIZE = true
  TYPEORM_MIGRATIONSRUN = true
  TYPEORM_LOGGING = true
  TYPEORM_ENTITIES = src/**/**.entity.ts
  #TYPEORM_ENTITIES = src/**/**.entity.js
  TYPEORM_SUBSCRIBERS = src/subscriber/*.ts
  #TYPEORM_SUBSCRIBERS = src/subscriber/*.js
  TYPEORM_MIGRATIONS = src/database/migration/*.ts
  TYPEORM_MIGRATIONS_DIR = src/database/migration
  TYPEORM_SUBSCRIBERS_DIR = src/subscriber</code></pre>
  </div>
  </div>
  </p>
  
  <p>any help/hint is highly appreciated, thanks in advance.</p>