<?php $conn = mysql_connect('ip地址','用户名','密码); if($conn) { mysql_select_db("codo_cmdb",$conn); $sql="select * from asset_server"; $result=mysql_query($sql); while($row = mysql_fetch_array($result)){ echo $row['private_ip']; echo "<br>"; }; echo 'mysql connect success'; }else { die("无法连接数据库".mysql_error()); } mysql_close($con); ?>
标签:数据库,mysql,测试,error,php,连接 From: https://www.cnblogs.com/lucktomato/p/16709241.html