我授予了所有特权。这是一个脚本:
<?php
require_once 'login.php';
$conn = new mysqli($hn, $un, $pw, $db);
if ($conn->connect_error) die($conn->connect_error);
?>我在浏览器中有一条消息:
警告: mysqli::mysqli():(HY000/1045):第11行C:\xampp\htdocs\web-datos\connect_mysql.php中用户'username'@'localhost‘(使用密码: YES)的访问被拒绝 拒绝用户‘用户名’@‘localhost’的访问(使用密码: YE )
我试着连接但没有成功。
我该如何解决这个问题?
发布于 2016-06-13 02:19:31
我相信您无法连接到mysql数据库。您需要授予对用户名@localhost的访问权限。
grant all privileges on yourdb.* to username@localhost identified by 'password';如果尚未创建,user.you可以使用此命令创建新用户。
create user 'newuser'@'localhost' identified BY 'password';您也可以键入您的用户或密码wrong.please,检查它。
https://stackoverflow.com/questions/37780858
复制相似问题