Mysql connection on new install on a MAC
Posted: Wed Sep 29, 2010 3:14 pm
Hi, I have installed Mysql and PHP 5 and when I go to test php <info> I can see the Mysql section is there. I can run php scripts so all is fine there. Terminal n to mysql and can create db's.
I have added a test db with a user and password, set the permissions so it can see the dbs and has all privileges. But when I run the mysql_connect e.g.
and it only comes back with unable to connect, so questions are?
What have I done wrong?
How do I see the log files for php and mysql on a Mac?
I have added a test db with a user and password, set the permissions so it can see the dbs and has all privileges. But when I run the mysql_connect e.g.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>???</title>
<meta http-equiv="content-type"
cotent="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$username = "pee_wee";
$password = "let_me_in";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";
// you're going to do lots more here soon
mysql_close($dbh);
?>
</body>
</html>What have I done wrong?
How do I see the log files for php and mysql on a Mac?