I've installed MySQL on my Mac Pro (v5.1.51 from the .dmg) so that I can develop and test locally with php. Eventually, I will publish the finished php to my website along with (hopfeully) the MySQL database(s) I create.
1) The server is running (System Preferences --> MySQL).
2) I can connect as "root" in Terminal and add a password, create databases (after granting privileges), etc.
The problem comes when I try to open a php page with the following code:
<?php
$con = mysql_connect("server","user","pw");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
I get the following error msg:
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'
I've spent 2-3 hours looking for solutions on the web. mysql.sock doesn't exist on my machine. Nor, for that matter, does etc/my.cnf. And yes, I checked for mysql.sock in /tmp/ rather than /var/.
Any thoughts would be much appreciated.
Randy
1) The server is running (System Preferences --> MySQL).
2) I can connect as "root" in Terminal and add a password, create databases (after granting privileges), etc.
The problem comes when I try to open a php page with the following code:
<?php
$con = mysql_connect("server","user","pw");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
I get the following error msg:
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'
I've spent 2-3 hours looking for solutions on the web. mysql.sock doesn't exist on my machine. Nor, for that matter, does etc/my.cnf. And yes, I checked for mysql.sock in /tmp/ rather than /var/.
Any thoughts would be much appreciated.
Randy