mysql php connection problem in windows 7
i install windows7 ultimate and php 5.3.1 and mysql server 5.1
mysql server work fine from
mysql>
and if see phpinfo();
i get the following table
mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version mysqlnd 5.0.5-dev - 081106 - $Revision: 289630 $
Persistent cache enabled
put_hits 0
put_misses 0
get_hits 0
get_misses 0
size 2000
free_items 2000
references 2
but when i connect with following php command
$db_host="localhost";
$db_name="mysql";
$db_user="root";
$db_pass="*****";
开发者_运维百科 $dbc=mysql_connect($db_host,$db_user,$db_pass) OR DIE (mysql_error());
$dbs=mysql_select_db($db_name) OR DIE (mysql_error());
when i run page, page take long time in loading and then return nothing. and if i pass any query it return false, i think its connection problem.
Thanks
Yes, use 127.0.0.1 instead of localhost. Alternatively you can disable IPv6 or disable the IPv6 localhost alias in your HOSTS file.
You should try to connect using pure php.exe, not web server. What error message is shown? Also maybe try '127.0.0.1' intsead of 'localhost'
精彩评论