- 论坛徽章:
- 0
|
apache 2.2.3 +php 5.2.9 在10.0.0.1上
Mysql 5.1.34在10.0.0.2上。
在10.0.0.1上,phpinfo可以正常运行,与mysql相关的附在最后。同时可以使用Mysql客户端可以连上10.0.0.2上的mysql数据库,可正常操作。也可以直接连接本机的数据库。
但是使用php直接连接(账号、密码同用客户端连的)10.0.0.2就报错:Can't connect to MySQL server on '10.0.0.2' 。
请各位分析一下,谢谢!
http的错误日志
[error] [client 10.0.0.1] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on ‘10.0.0.2’(13) in /var/www/html/index.php on line 15
[error] [client 10.0.0.1] PHP Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /var/www/html/index.php on line 19
[error] [client 10.0.0.1] PHP Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/html/index.php on line 20
[error] [client 10.0.0.1] PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /var/www/html/index.php on line 21
php代码15行开始:
- $conn=mysql_connect("10.0.0.2","test","111222") ;
- if(!$conn){
- echo mysql_error();
- }
- mysql_select_db("briap",$conn);
- $r = mysql_query("select count(*) from test",$conn);
- while($o = mysql_fetch_object($r)){
- print_r($o);
- }
- echo "$r";
复制代码
mysql[tr]MySQL Supportenabled[/tr] Active Persistent Links 0
Active Links 0
Client API version 5.0.81
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib64/mysql -lmysqlclient
[tr]DirectiveLocal ValueMaster Value[/tr] mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off
mysqli[tr]MysqlI Supportenabled[/tr] Client API library version 5.0.81
Client API header version 5.0.45
MYSQLI_SOCKET /var/lib/mysql/mysql.sock
[tr]DirectiveLocal ValueMaster Value[/tr] mysqli.default_host no value no value
mysqli.default_port 3306 3306
mysqli.default_pw no value no value
mysqli.default_socket no value no value
mysqli.default_user no value no value
mysqli.max_links Unlimited Unlimited
mysqli.reconnect Off Off
PDO[tr]PDO supportenabled[/tr] PDO drivers mysql, sqlite
pdo_mysql[tr]PDO Driver for MySQL, client library version5.0.81[/tr]
[ 本帖最后由 iix 于 2009-5-15 14:30 编辑 ] |
|