Title: Command in Lumen is not connecting with AWS RDS
Tags: amazon-web-services;lumen;amazon-elastic-beanstalk
Question: I have a Lumen 5.7 application in Elastic Beanstalk with PHP 7.2, there are several endpoints that are working correctly, get and insert data in the RDS.
But a Lumen command (that i created) is tryng to connect to localhost, ignoring the environment configuration.
I execute this command via ssh.

I received this error:

```[2019-03-29 18:37:01] production.ERROR: PDOException: SQLSTATE[HY000] [2002] Connection refused in /var/app/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
Stack trace:
#0 /var/app/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(27): PDO-&gt;__construct('mysql:host=127....', 'forge', '', Array)
#1 /var/app/current/vendor/illuminate/database/Connectors/Connector.php(67): Doctrine\DBAL\Driver\PDOConnection-&gt;__construct('mysql:host=127....', 'forge', '', Array)
#2 /var/app/current/vendor/illuminate/database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector-&gt;createPdoConnection('mysql:host=127....', 'forge', '', Array)
#3 /var/app/current/vendor/illuminate/database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector-&gt;createConnection('mysql:host=127....', Array, Array)
```

It is trying to connect to 708-362-5947 with the user forge.
There is not a .env file in the server.
Locally the command works correctly.
Can someone help me please?

Edit:
I've added the config/database.php file with the next code

```return [
    'default' =&gt; 'mysql',
    'connections' =&gt; [
        'mysql' =&gt; [
            'driver' =&gt; 'mysql',
            'host' =&gt; env('DB_HOST'),
            'database' =&gt; env('DB_DATABASE'),
            'username' =&gt; env('DB_USERNAME'),
            'password' =&gt; env('DB_PASSWORD'),
            'charset'   =&gt; 'utf8',
            'collation' =&gt; 'utf8_unicode_ci',
        ]
    ],

    'migrations' =&gt; 'migrations',

];
```

And now I get this error:

```production.ERROR: InvalidArgumentException: Database hosts array is empty. in /var/app/current/vendor/illuminate/database/Connectors/ConnectionFactory.php:203
```



Edit 2
I deployed again and I received this error now:

```[2019-03-30 01:12:53] local.ERROR: PDOException: SQLSTATE[HY000] [1045] Access denied for user 'user'@'xx.xx.xx.xx' (using password: YES) in /var/app/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
Stack trace:
#0 /var/app/current/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(27): PDO-&gt;__construct('mysql:host=dev-...', 'user', 'mypass...', Array)
#1 /var/app/current/vendor/illuminate/database/Connectors/Connector.php(67): Doctrine\DBAL\Driver\PDOConnection-&gt;__construct('mysql:host=dev-...', 'user', 'mypass...', Array)
#2 /var/app/current/vendor/illuminate/database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector-&gt;createPdoConnection('mysql:host=dev-...', 'user', 'mypass...', Array)
#3 /var/app/current/vendor/illuminate/database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector-&gt;createConnection('mysql:host=dev-...', Array, Array)
#4 /var/app/current/vendor/illuminate/database/Connectors/ConnectionFactory.php(182): Illuminate\Database\Connectors\MySqlConnector-&gt;connect(Array)
```

Connection data is correct, but the user appears with the server ip ```knightdouglas@example.net``` and I don't know if this is correct.


Here is the accepted answer: The password included a '$' character. For some reason Lumen truncated the password before of this character. It was removed and everything works again.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:03/29/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<amazon-web-services><lumen><amazon-elastic-beanstalk>', 'Title': 'Command in Lumen is not connecting with AWS RDS', 'ViewCount': 313, 'id': 55424290, 'user_AboutMe': '<p>I am Marco<br>\na web and android developer</p>\n', 'user_AccountId': 5218428.0, 'user_DisplayName': 'Marco Antonio', 'user_Reputation': 61.0, 'user_Views': 11.0, 'user_id': 4172591.0}}