Hello Everyone,
I am running OS X version 10.5.6 and MySQL version 5.0.67
I have enabled the inbuilt PHP and webserver which was pre-installed on my MAC. I did this using
http://foundationphp.com/tutorials/php_leopard.php
I can run basic PHP code, but i can not connect to MySQL through PHP.
The code i use to connect to MySQL is:
However when i run this i get the following error on the web page:
I would really appreciate any help
Thanks in Advance and Regards,
-Neb
I am running OS X version 10.5.6 and MySQL version 5.0.67
I have enabled the inbuilt PHP and webserver which was pre-installed on my MAC. I did this using
http://foundationphp.com/tutorials/php_leopard.php
I can run basic PHP code, but i can not connect to MySQL through PHP.
The code i use to connect to MySQL is:
Code:
<html>
<body>
<?php
mysql_connect("localhost", "<username>", "<password>") or die(mysql_error());
echo "Connected to MySQL<br />";
?>
</body>
</html>
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) in /Library/WebServer/Documents/examples/testconnection.php on line 4
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
I would really appreciate any help
Thanks in Advance and Regards,
-Neb