Sorry, Im absolutly newbbie with php and mysql. I read a lot of tutorials, manuals, readmes and etc. I took the code from the books but cannot make them work. I have a database created with some data in some tables. I can connect with the client mysql this way:
#mysql -u root -pmy_secret_password
that's ok.
I also created another user called php:
#mysql -u root -pmy_other_password
No problem with that.
But from within php:
<?
function cnx()
{
$host='localhost';
$usr='php';
$passwd='my_other_password'
$bd='regofer';
$idconex=mysql_connect($host,$usr,$paswd);
if(!$idconex)
{
echo "Error connecting server $host with user name $usr";
exit();
}
if (!mysql_select_db($bd,$idconex))
{
echo "Error opening data base $bd";
exit();
}
return $idconex;
}
$idconex=cnx();
?>
(I tried with other usr/password, always the same)
Warning: Can't connect to local MySQL server trhough socket '/var/lib/mysql.sock' (111) in /usr/local/apache/htdocs/phpdocs/cnx.php on line 10
followed by my own error message.
I wander if anyone can help me. Thanks in advance.
Cannot connect to mysql
Moderator: General Moderators
-
matecocido
- Forum Newbie
- Posts: 6
- Joined: Wed Feb 26, 2003 4:59 pm
- Location: Buenos Aires
-
matecocido
- Forum Newbie
- Posts: 6
- Joined: Wed Feb 26, 2003 4:59 pm
- Location: Buenos Aires