数据库不存在。但确实如此

database does not exist. but it does

所以我想在我的主页上安装一个acp。我将所有需要的文件上传到我的网络服务器(我使用 FileZilla Client)并使用 xampp 打开 phpMyAdmin。 它连接数据库但随后显示

"Database does not exist."

我对使用 phpMyAdmin 还很陌生,mySQL 也是如此。

这是我的 db.php 的样子:

   <?php
$host = "localhost"; // database server
$user = "akichuchan"; // db username
$pw = "cherryjuice"; // db password    
$db = "acp"; // db name     

$link = mysql_connect($host, $user, $pw, $db) or die ("No connection possible.");    
mysql_select_db($db, $link) or die ("Database does not exist.");     
?>

我做错了什么? 提前致谢。 :)

试试下面的工作代码:

<?php
$host = "localhost"; // database server
$user = "akichuchan"; // db username
$pw = "cherryjuice"; // db password    
$db = "acp"; // db name     

$link = mysql_connect($host, $user, $pw) or die ("No connection possible.");    
mysql_select_db($db, $link) or die ("Database does not exist.");     
?>

注意:不要使用"mysql_"。最好使用 " PDO 或 Mysqli_ "(安全可靠)。