PhpMyAdmin - 可以恢复localhost访问吗?

时间:2016-06-21 13:59:02

标签: mysql phpmyadmin

除了愚蠢之外什么都没用我已经设法从我的MySql数据库中删除了localhost访问权限,因此PhpMyAdmin将无法运行,尽管一个简单的示例脚本仍可正常运行。我昨天才开始愤怒地使用它,所以会有点帮助吗?

{
 phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
}

这是工作程序的一个片段,从W3C站点开始,它可以与任何有效用户一起使用,并使其他用户失败。为什么不能运行phpmyadmin,以及重写了哪个配置文件?

{
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "sql_learn";

try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT _id, _gibb FROM gibberish");
$stmt->execute();

// set the resulting array to associative
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) {
    echo $v;
}

1 个答案:

答案 0 :(得分:1)

我不知道你做了什么或改变了什么,但是如果你正在使用像xampp或wamp这样的东西,你可以随时转到./xampp/phpmyadmin目录并将config.sample.inc.php的内容复制到{ {1}}并填写您的设置。