Wamp phpMyAdmin错误#1045-用户'root'@'localhost'的访问被拒绝 [英] Wamp phpMyAdmin error #1045 - Access denied for user '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!
无论我输入什么密码或仅按Enter键,它都会向我显示相同的错误,因此我无法清除特权".
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步:输入提供的命令行
$ use mysql;
$ UPDATE mysql.user SET password="PASSWORD("YourPassword") WHERE user="root";
$ FLUSH PRIVILEGES;
$ exit;
$use mysql;
$UPDATE mysql.user SET password="PASSWORD("YourPassword") WHERE user="root";
$FLUSH PRIVILEGES;
$exit;
第3步:打开并编辑位于本地服务器文件中的config.inc.php文件
- 转到我的电脑">"C驱动器">(您的本地服务器文件夹, WAMP/MAMP/XAMPP)>应用程序> PHPMYADMIN> config.inc.php
- 使用文本编辑器(例如Notepad ++)打开config.inc.php文件.
- 找到以下代码行:$ cfg ['Servers'] [$ i] ['password'] =''; //MySQL密码
- 更改['password'] =''; --to-> ['password'] ='YourPassword';使用您在步骤2中创建的新密码.
- 点击保存
- Go to My Computer > C Drive > ( Your Local Server Folder, WAMP/MAMP/XAMPP ) > APPS > PHPMYADMIN > config.inc.php
- Using a text editor, such as Notepad++, open your config.inc.php file.
- Find this line of code: $cfg['Servers'][$i]['password'] = ''; // MySQL password
- Change ['password'] = ''; --to--> ['password'] = 'YourPassword'; with the new chosen password you created from Step 2.
- Click Save
第4步:转到phpmyadmin
转到http://localhost/phpMyAdmin/
.
这篇关于Wamp phpMyAdmin错误#1045-用户'root'@'localhost'的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!