标题重写为:严重错误:无法访问用户'Adeleke'@'localhost'的mysqli_sql_exception异常(使用密码:是)
P粉311464935
2023-08-24 21:43:22
<p>我尝试使用 XAMMP(本地主机)测试我的 php 软件,但在点击 URL 后,我不断收到:</p>
<pre class="brush:php;toolbar:false;">Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'Adeleke'@'localhost' (using password: YES)</pre>
<p>我以为它来自 xammp <strong>PhpMyAdmin</strong>,所以我安装了 Laragon 并尝试在其上测试该软件,下面是它显示的内容</p>
<pre class="brush:php;toolbar:false;">Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'Adeleke'@'localhost' (using password: YES) in C:\laragon\www\MyQueerDate\install\index.php:47 Stack trace: #0 C:\laragon\www\MyQueerDate\install\index.php(47): mysqli_connect('127.0.0.1', 'Adeleke', 'Badvibe019!', 'Laragon.MySQL') #1 {main} thrown in C:\laragon\www\MyQueerDate\install\index.php on line 47</pre>
<p>这是 MyQueerDate\install\index.php 第 46 - 49 行的代码:</p>
<pre class="brush:php;toolbar:false;">if (!empty($_POST['install'])) {
$con = mysqli_connect($_POST['sql_host'], $_POST['sql_user'], $_POST['sql_pass'], $_POST['sql_name']);
if (mysqli_connect_errno()) {
$ServerErrors[] = "Failed to connect to MySQL: " . mysqli_connect_error();</pre>
<p>我尝试检查软件的输出并查看仪表板和管理面板,但它一直显示;</p>
<pre class="brush:php;toolbar:false;">Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'Adeleke'@'localhost' (using password: YES) in C:\laragon\www\MyQueerDate\install\index.php:47 Stack trace: #0 C:\laragon\www\MyQueerDate\install\index.php(47): mysqli_connect('127.0.0.1', 'Adeleke', 'Badvibe019!', 'Laragon.MySQL') #1 {main} thrown in C:\laragon\www\MyQueerDate\install\index.php on line 47</pre>
<p>我在 cPanel 上尝试过,它可以工作,但我不想在 cPanel 上测试程序,我现在无力支付托管费用,我想尝试 localhost。</p>
创建一个新用户并使用它来访问您的数据库。
查询: 创建用户'user'@'localhost'; 授予 urdatabase.* 上的所有权限给“密码”标识的“用户”@“本地主机”;