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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.