<?php
$conn=mysql_connect("localhost","root","");
if ($conn)
{
echo "Mysql Connect Successfully!";
}
else
{
echo "Mysql Connect Failed!";
}
?>
我把php mysql apache都重新编译了七八次了
不明白究竟是哪里没有配置好
php.ini文件中mysql段
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On
; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1
; Maximum number of links (persistent + non-persistent). -1 means no limit.
mysql.max_links = -1
; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
at MYSQL_PORT.
mysql.default_port =
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =
; Default host for mysql_connect() (doesnt apply in safe mode).
mysql.default_host =
; Default user for mysql_connect() (doesnt apply in safe mode).
mysql.default_user =
其它都是自动安装来的
可能是php库里里没有包涵操作mysql数据的函数,你可以用phpinfo()函数看一看是不是支持mysql。
列出你的编译开关