18

I've setup wamp server on window. Then, I use MySQL root password by cmd. As a result, when I access phpMyAdmin site, Access denied appeared (Default user for phpMyAdmin is root and password is blank/empty). So, how could I change config variables in phpMyAdmin with new password of root.

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

$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.

Bud Damyanov
  • 30,171
  • 6
  • 44
  • 52
Quyen Le
  • 195
  • 1
  • 1
  • 9

6 Answers6

23

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%)

$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

Aron
  • 15,464
  • 3
  • 31
  • 64
Tiep Phan
  • 12,386
  • 3
  • 38
  • 41
  • Yes, It works, thank for your help. I've editted file config but in folder wamp\scripts not wamp\apps\phpmyadmin4.1.14, so stupid :) Sorry I can't vote you answer up because I don't have privileges enoungh. Newbie I'm – Quyen Le May 29 '14 at 01:50
  • Someone could vote this answer up. In that video has some other customize config – Quyen Le May 29 '14 at 01:58
  • +1 as it helps @QuyenLe but it is not a good answer according to SO. There should be no external links in answer. – عثمان غني May 30 '14 at 04:30
  • @QuyenLe Mark this answer as accepted. Better if you edit this answer and add what you exactly done to help others. thanks – عثمان غني May 30 '14 at 09:56
  • you can also open an Incognito windows instead of disabling extentions – Vahid Jul 25 '20 at 13:27
15

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

SET PASSWORD FOR root@localhost = PASSWORD('yourpassword');
Dharmesh Hadiyal
  • 719
  • 1
  • 7
  • 18
  • 2
    Try to understand his problem. He has problem logging into PMA. He already changed the password. – عثمان غني May 28 '14 at 09:53
  • Yes, as عثمان غني said – Quyen Le May 28 '14 at 09:59
  • This helped me nonetheless workaround a problem where I needed to reset the password for a user, not root, in MySQL DB used by WordPress on an ISP. I used the command to reset the password (for userxyz instead of root) within php-MyAdmin using SQL window. Then I changed the webroot/wp-config.php file to update the password in that file. I tested and all worked fine. Note that upon changing the password the PMA session ended and I had to login again with the new password. Then I modified wp-config.php. Then tested. – subsci Jan 13 '17 at 01:22
7

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.

Mahmoud Zalt
  • 30,478
  • 7
  • 87
  • 83
0

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-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:

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

... to this:

 $cfg['Servers'][$i]['password']      = 'newpassword';
Ezhil
  • 996
  • 8
  • 13
  • Thank but maybe I talk my trouble not clearly enoungh. I can change password of root as you said. But, what I need is reconfig phpmyadmin to use new user/password. To avoid access denied. Sorry for my bad english – Quyen Le May 28 '14 at 09:47
0

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;
Arockia Raj
  • 31
  • 1
  • 2
  • 9
0

I had to do 2 steps:

  • follow Tiep Phan solution ... edit config.inc.php file ...

  • follow Mahmoud Zalt solution ... change password within phpmyadmin

dsdsdsdsd
  • 2,880
  • 6
  • 41
  • 56