【发布时间】:2021-12-27 15:21:58
【问题描述】:
我应该怎么做才能解决这个错误?
错误:
致命错误:未捕获的 mysqli_sql_exception:未知数据库 'testdb' 在 D:\xampp\htdocs\dashboard\project\connection.php:6 堆栈跟踪:#0 D:\xampp\htdocs\dashboard\project\connection.php (6): mysqli->__construct('localhost', 'root', '#Geoinformatici...', 'testdb') #1 {main} 在 D:\xampp\htdocs\dashboard\project\connection.php 中抛出在第 6 行
括号 IDE 中的代码
<?PHP
$server = 'localhost';
$username = 'root';
$password = '#Geoinformaticionno1';
$database = 'testdb';
$connection = new mysqli($server, $username, $password, $database) or die("not connected");
echo "connected"
?>
让我知道是否需要其他任何东西才能解决此错误。
【问题讨论】:
-
Unknown database 'testdb'在你的mysql安装中找不到数据库testdb。仔细检查创建了哪些数据库。
标签: php database server xampp localhost