Wamp phpMyAdmin 错误 #1045 - 用户 'root'@'localhost' 拒绝访问
这是一个很常见的问题,我找到了很多教程来帮助我解决它,但我的案例还有一个问题......
This is quite common problem and I found a lot of tutorials to help me solve it, although, there is one additional problem with my case...
这是我在 config.inc.php 中的配置设置
This is my config settings in config.inc.php
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true;
当我尝试通过 wamp 主页登录时,错误显示:
When I try to log in via wamp main page, the error shows:
当我尝试通过 CONSOLE 访问 MyAdmin 时也是如此!
AND this same is when I try to acces MyAdmin by CONSOLE!
无论我输入什么密码或按回车键,它都会向我显示同样的错误,因此我无法刷新特权".
No matter what I type as password or just press enter, it shows me this same error, and because of that i cant 'flush priviliges'.
我能做什么?
推荐答案
步骤 1:打开 MySQL 控制台.
第 2 步:输入提供的命令行
$使用mysql;
$UPDATE mysql.user SET password="PASSWORD("YourPassword") WHERE user="root";
$刷新权限;
$exit;
第 3 步:打开并编辑位于本地服务器文件中的 config.inc.php 文件
- 转到我的电脑 > C 盘 >(您的本地服务器文件夹,WAMP/MAMP/XAMPP) > 应用程序 > PHPMYADMIN > config.inc.php
- 使用文本编辑器(例如 Notepad++)打开您的 config.inc.php 文件.
- 找到这行代码:$cfg['Servers'][$i]['password'] = '';//MySQL 密码
- 更改 ['密码'] = '';--to--> ['密码'] = '你的密码';使用您在第 2 步中创建的新密码.
- 点击保存
第 4 步:转到 phpmyadmin转到 http://localhost/phpMyAdmin/
.
相关文章