Reputation: 13
I'm trying to create a connection to a local Database Server through a VPN connection first.
From the VPN connection I receive this IP for my network: 192.168.30.2
DB-Server: 192.168.40.150
If I try to ping the DB Server IP via PHP, I also get a response from the Server. When, however, I try to make the PDO connection or with "mysqli", I receive the following error:
lluminate \ Database \ QueryException: SQLSTATE [HY000] [1045] Access denied for user 'xxxx'@'192.168.30.2' (using password: YES) (SQL: select * from `xxxx`) in file
If I use a Mysql Client from my PC it's working fine!
Any idea?
Upvotes: 0
Views: 892
Reputation: 13
SOLVED: the DB server required a SSL Connection (without Cert). These options was required in the PDO connection:
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT
PDO::MYSQL_ATTR_SSL_CA
If you use Laravel Illuminate for the connection you need to declerate the options in the connection, example:
...
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('MY_SSL_VERIFY', ' '),
PDO::MYSQL_ATTR_SSL_CA => env('MY_SSL_CA', ' '),
]) : [],
...
In this case is really important to give a Value with empty space ' '
otherwise will the Illuminate PDO Connector not get the option values.
Upvotes: 1