我有一个问题,我的项目是在我的windowsos工作,我尝试它转移到ubuntu16.04操作系统,静态ip地址。现在当我试图访问该项目时,它一直说数据库连接错误!
<?php
$db_password = "Welcome1";
$server = "192.168.2.218";
try{
$pdo_conn = new
PDO("mysql:host=$server;dbname=boldr","phpmyadmin","
{$db_password}");
} catch (PDOException $e){
die("Database Connection Error!");
}
$conn = mysqli_connect("192.168.2.218","phpmyadmin","{
$db_password}") or die(mysqli_error($conn));
mysqli_select_db($conn,'boldr') or die("cannot select DB");
?>
1条答案
按热度按时间ppcbkaq51#
你的数据库在同一台服务器上吗?如果是,请尝试127.0.0.1或localhost。