php 在 phpMyAdmin 中更改 MySQL 根密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23907736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:01:48  来源:igfitidea点击:

Change MySQL root password in phpMyAdmin

phpmysqlphpmyadmin

提问by Quyen Le

I've setup wampserver on window. Then, I use MySQL rootpassword by cmd. As a result, when I access phpMyAdmin site, Access deniedappeared (Default user for phpMyAdmin is rootand password is blank/empty). So, how could I change configvariables in phpMyAdmin with new password of root.

我已经wamp在窗口上设置了服务器。然后,我root通过 cmd使用 MySQL密码。结果,当我访问 phpMyAdmin 站点时,Access denied出现了(phpMyAdmin 的默认用户是root,密码是blank/empty)。那么,如何config使用 root 的新密码更改phpMyAdmin 中的变量。

I've searched for solution on Internet, someone advise me add some line to config.inc.phpas:

我在互联网上搜索了解决方案,有人建议我添加一些行config.inc.php

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'Changed';
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = false;

But, It seem not work. Thanks.

但是,它似乎不起作用。谢谢。

回答by Tiep Phan

Explain what video describe to resolve problem

解释什么视频描述了解决问题

After Changing Password of root (Mysql Account). Accessing to phpmyadmin page will be denied because phpMyAdmin use root/''(blank) as default username/password. To resolve this problem, you need to reconfig phpmyadmin. Edit file config.inc.php in folder %wamp%\apps\phpmyadmin4.1.14 (Not in %wamp%)

更改root(Mysql帐户)的密码后。访问 phpmyadmin 页面将被拒绝,因为 phpMyAdmin 使用 root/''(blank) 作为默认用户名/密码。要解决此问题,您需要重新配置 phpmyadmin。编辑文件夹 %wamp%\apps\phpmyadmin4.1.14 中的文件 config.inc.php(不在 %wamp% 中)

$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'changed';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

If you have more than 1 DB server, add "i++" to file and continue add new config as above

如果您有 1 个以上的数据库服务器,请将“i++”添加到文件中并继续添加新配置,如上

回答by Dharmesh Hadiyal

You can change the mysql root password by logging in to the database directly (mysql -h your_host -u root) then run

可以直接登录数据库修改mysql root密码(mysql -h your_host -u root)然后运行

SET PASSWORD FOR root@localhost = PASSWORD('yourpassword');

回答by Mahmoud Zalt

0) go to phpmyadmin don't select any db
1) Click "Privileges". You'll see all the users on MySQL's privilege tables.
2) Check the user "root" whose Host value is localhost, and click the "Edit Privileges" icon.
3) In the "Change password" field, click "Password" and enter a new password.
4) Retype the password to confirm. Then click "Go" to apply the settings.

0) 转到 phpmyadmin 不要选择任何数据库
1) 单击“权限”。您将看到 MySQL 权限表上的所有用户。
2) 勾选Host值为localhost的root用户,点击“Edit Privileges”图标。
3) 在“更改密码”字段中,单击“密码”并输入新密码。
4) 再次输入密码进行确认。然后单击“开始”以应用设置。

回答by dsdsdsdsd

I had to do 2 steps:

我必须做两个步骤:

  • follow Tiep Phansolution ... edit config.inc.phpfile ...

  • follow Mahmoud Zaltsolution ... change password within phpmyadmin

  • 按照Tiep Phan解决方案...编辑config.inc.php文件...

  • 按照Mahmoud Zalt解决方案......在phpmyadmin中更改密码

回答by Ezhil

you can use this command

你可以使用这个命令

 mysql> UPDATE mysql.user SET Password=PASSWORD('Your new Password') WHERE User='root';

check the links http://www.kirupa.com/forum/showthread.php?279644-How-to-reset-password-in-WAMP-serverhttp://www.phpmytutor.com/blogs/2012/08/27/change-mysql-root-password-in-wamp-server/

检查链接 http://www.kirupa.com/forum/showthread.php?279644-How-to-reset-password-in-WAMP-server http://www.phpmytutor.com/blogs/2012/08/ 27/change-mysql-root-password-in-wamp-server/

Find your config.inc.php file under the phpMyAdmin installation directory and update the line that looks like
this:

在 phpMyAdmin 安装目录下找到您的 config.inc.php 文件并更新如下所示的行

$cfg['Servers'][$i]['password']      = 'password';

... to this:

...到这个:

 $cfg['Servers'][$i]['password']      = 'newpassword';

回答by Arockia Raj

Change It like this, It worked for me. Hope It helps. firs I did

像这样改变它,它对我有用。希望能帮助到你。我做的第一件事

$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'changed';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

Then I Changed Like this...

然后我就变成这样了……

$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;