After an upgrade to El Capitan I\'m having issues connecting to MySql. I have a basic PHP file called index.php
with the following code:
Try using localhost instead of 127.0.0.1 and also make sure the username/password you are using are correct and exist on the mysql server. Also check mysqld is running and that your firewall is allowing the mysql database through.
Edit your php.ini file and make sure extension extension=php_mysqli.dll is enabled on Windows or extension=php_mysqli.so on Linux.
Try the answer here: PHP - MYSQL - test database server
There are two settings you have to check for this to work (assuming you have MySQL server installed of course):
Check the value of mysql.default_socket in your PHP configuration.
Check the value of socket in your MySQL configuration file under the [mysqld] heading.
Those values have to be identical; if they're not, change one to match the other and restart respective service.