/var/lib/mysql/mysql.sock is created when the mysql server starts. It disappears when
mysql shuts
down.
Did you provide access to the databases as root? Is there a password associated with
access? For
instance, how do you statr mysql from the command line: mysql -u root -ppassword
mydatabase
rick
"People will forget what you said. People will forget what you did.
But people will never forget how you made them feel."
----- Original Message -----
From: "Sami Maisniemi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 22, 2004 12:25 PM
Subject: PHP script cannot connect MySQL server
I finally managed to install MySQL succesfully. I created a simple DB with two
different tables. I also created a simple PHP script to list all DBs and
tables.
However, it seems that the PHP script cannot access MySQL server, because the
following error message is displayed:
Warning: mysql_connect(): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2) in /srv/www/htdocs/sqltest.php on line 4
Warning: mysql_list_dbs(): supplied argument is not a valid MySQL-Link
resource in /srv/www/htdocs/sqltest.php on line 5
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /srv/www/htdocs/sqltest.php on line 6
Any idea what might be wrong? There is no file 'mysql.sock' in '/var/lib/
mysql'. The PHP script is as follows:
<html><body>
<?php
$link_id = mysql_connect("localhost", "root");
$result = mysql_list_dbs($link_id);
$num_rows = mysql_num_rows($result);
while ($db_data = mysql_fetch_row($result)) {
echo $db_data[0]. "<BR>";
$result2 = mysql_list_tables($db_data[0]);
$num_rows2 = mysql_num_rows($result2);
while ($table_data = mysql_fetch_row($result2)) {
echo "--" . $table_data[0]. "<BR>";
}
echo "==> $num_rows2 table(s) in " . $db_data[0] . "<BR>";
}
?>
</body></html>
Regards Sami
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]