主题:请教数据库连接问题 谢谢
下面是书上的连接数据库的程序,2月6日上传到服务器上后,对2、4行给出下面警告:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)in /.../...on line 2
3月5日上传到服务器上后,对2、4行给出下面警告:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /.../...on line 4
我是个初学者,不知道上面的警告是说“不支持使用数据库”,还是别的什么问题?
谢谢!
<?php
$connection1=mysql_connect ("localhost","root","password");
echo $connection1."<br>";
$connection2=mysql_pconnect ("localhost","root","password");
echo $connection2;
?>
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)in /.../...on line 2
3月5日上传到服务器上后,对2、4行给出下面警告:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /.../...on line 4
我是个初学者,不知道上面的警告是说“不支持使用数据库”,还是别的什么问题?
谢谢!
<?php
$connection1=mysql_connect ("localhost","root","password");
echo $connection1."<br>";
$connection2=mysql_pconnect ("localhost","root","password");
echo $connection2;
?>