mysql_connect("$host","$user","$password") or die(mysql_error());
我改成ip了,是这个样子: <html> <title>My First php</title> <body> <?php $host="localhost"; $user="root"; $password="wwwx1000"; //连接MySQL数据库 mysql_connect("$host","$user","$password") or die(mysql_error()); ?> </body> </html> 但是结果成了这个样子: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
<html>
<title>My First php</title>
<body>
<?php
$host="localhost";
$user="root";
$password="wwwx1000";
//连接MySQL数据库
mysql_connect("$host","$user","$password") or die(mysql_error());
?>
</body>
</html>
但是结果成了这个样子:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
[root@wcs ~]# /etc/init.d/mysqld status
mysqld (pid 4079) 正在运行...
[root@wcs ~]#