Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hi I've been having a problem getting phpmyadmin to work consistently on my XP desktop and laptop computers for months now. When I type into Chrome's browser on both machines, localhost/phpmyadmin, I kept getting Error #1045 Access Denied for user at root@localhost (using password yes).

Eventually, I realized that I had two (2) versions of mysql installed (XAMPP and MySQL Server 5.1) on both machines. So I uninstalled the MySQL Server 5.1I from the desktop and phpmyadmin worked. But when I uninstalled MySQL Server 5.1 from my laptop, it did not work. But I realized I could still get into MySQL Commandline Client using my password and that my databases were still intact. So I uninstalled and reinstalled XAMPP on the laptop and phpmyadmin worked after that.

Now I have a new problem. On phpMyAdmin's home page has a message at the bottom:

Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user 'root'.

So I located the following lines in config.inc.php file:

/* Authentication type and info */

$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['user'] = 'root';

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

$cfg['Servers'][$i]['AllowNoPassword'] = true;

and I just changed the last 2 lines as follows:

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

$cfg['Servers'][$i]['AllowNoPassword'] = false;

As soon as I did that and I tried to access phpmyadmin again, I got the Error #1045 message again, but when I tried https://localhost/phpmyadmin/ I got a red page saying this sites certificate is not trusted would you like to proceed anyway. And now it only works using https.

I would really like to settle all my phpmyadmin problems once and for all so here are my questions: 1. Why does my laptop only access phpmyadmin via https? 2. How do I change my password in my configuration file?

Also, if you have any other tips regarding phpMyAdmin, they are very welcome. Thanks in advance

share|improve this question

migrated from stackoverflow.com Feb 16 '10 at 22:10

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

  1. If undoing the only changes you made doesn't fix http access, you made more than those changes.
  2. It doesn't want you to change the password in the phpMyAdmin configuration file. It wants you to change the root user's password in MySQL itself.
share|improve this answer
    
@ceejayoz, thanks for replying and providing that very useful link. I followed the instructions for putting a password as follows: set password for 'root'@'localhost' = password('mypassword'); and got Query OK, 0 rows affected. Good. But when I entered this line afterwards: set password for 'root'@'%' = password('mypassword'); I got this error: ERROR 1133 (42000): Can't find any matching row in the user table. I also tried to remove the Anonymous Account with the following commands: drop user ''; but I got error 1396 (HY000): Operation DROP USER failed for ''@'%' I am using XAMPP. –  Anthony Feb 16 '10 at 23:46
    
@ceejayoz, after changing my password as mentioned above, I get MySQL Error #1045 Access denied for user 'root' @ localhost' (using password: NO) when trying to access phpMyAdmin in Chrome's browser like this: localhost/phpmyadmin –  Anthony Feb 16 '10 at 23:55
    
@ceejayoz, I got it to work using Egdelwonk's solution from post serverfault.com/questions/54118/… Basically I need to change the password in the config.inc.php file as well. However, I was wondering whether this was safe because it is obviously not encrypted. –  Anthony Feb 17 '10 at 0:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.