测试php和mysql数据库是否关联的代码

在网站根目录下创建一个test.php文件,其内容为

<?php
$link=mysql_connect("localhost","root","12345"); //12345改成你的mysql密码
if(!$link) echo "失败!";
else echo "成功!";
mysql_close();
?>

在浏览器打开 http://localhost/test.php
如果输出成功,则说明大功告成了!

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.