After a failed Wordpress upgrade I got the error
Warning: mysqli_real_connect(): (HY000/1045): Access denied for user...
So I reinstalled WP, but still getting the same error. The strange thing is I can connect to the mysql server (remote host) via the mysql shell (on the same PHP server), just not via PHP. So doesn't seem to be a credentials/firewall issue.
I tried it with a separate script with only the mysqli_connect()
, but also no luck. I replaced the server host name with an IP, also did not work.
PHP: 7.0
Edit: It turned out that the mysql server required a ssl connection, so I had to add define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL);
to wp-config.php
.