Jump to content



Photo

Unable To Connect To Phpmyadmin

phpmyadmin password

  • Please log in to reply
5 replies to this topic

#1 angelsonearth

angelsonearth

    Member

  • Members
  • PipPip
  • 28 posts

Posted 28 August 2012 - 1:21 PM

Hello again, friends! I changed my password in MySQL, keeping the "root" component for the username. However, when I go into PHPmyadmin by typing localhost and then entering the PHPMyAdmin section, access is denied with the following message:

"phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server."

I am wondering what I need to do to be able to access the PHPMyAdmin area as I haven't done any work at all in PHPMyAdmin up to this stage. Please kindly advise--hopefully with some detail about the code if I need to re-enter the password and username I used in MySQL into PHPMyAdmin.

Thank you!
  • 0

#2 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,721 posts
  • LocationState College, PA (USA)

Posted 29 August 2012 - 8:29 AM

You have to edit the phpMyAdmin configuration file. See the phpMyAdmin docs for details.
  • 0

#3 angelsonearth

angelsonearth

    Member

  • Members
  • PipPip
  • 28 posts

Posted 29 August 2012 - 7:46 PM

Thank you, Larry! It's a good reason, too, to peruse the phpMyAdmin docs for the first time.

Before I sign off, would you please be so kind as to let me know whether I would need to use the same password and username (root) as I used in MySQL for phpMyAdmin. In other words, do the passwords for the root user need to be the same for both the MySQL client and phpMyAdmin?

Also, when using mysql_connect files, would I use the password and username for the MySQL root user or for the phpMyAdmin root user? Please forgive me for my confusion as I'm just starting to use the system. Once I'm active with using it, I think working with the actual code will be a lot easier than this initial set-up learning stage. Thank you so much for any and all advice.
  • 0

#4 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,721 posts
  • LocationState College, PA (USA)

Posted 31 August 2012 - 8:03 AM

Yes, they need to be the same. Here's the deal: MySQL has users, and a certain username/hostname/password combination is defined within MySQL to access it and do stuff. The command-line mysql client and the Web-based phpMyAdmin are just two clients--two ways of accessing the MySQL server. There are more MySQL clients, too. Regardless of the client, you need to use a valid username/hostname/password combination as defined in the server.
  • 0

#5 angelsonearth

angelsonearth

    Member

  • Members
  • PipPip
  • 28 posts

Posted 3 September 2012 - 11:03 PM

Thanks so much, Larry! I'm a big fan of your line of books for good reason! Congratulations on the excellent forum and terrifict writing! I thought it would be a nice touch to add the documentation for changing PHPMyAdmin's config file to reflect the new password. I copied and pasted the following from the XAMPP site:

Here it is:

With the"XAMPP Shell" (command prompt) you can also change the password. Open the shell and execute this command:
mysqladmin.exe -u root password secret


Of course, your password should not be "secret", too. In the next step you must adjust the phpMyAdmin configuration for this new password. In the file "\xampp\phpMyAdmin\config.inc.php" change the lines:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
to:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'secret';


Instead in the XAMPP Shell, you can also change the password with phpMyAdmin, and then adjust the phpMyAdmin configuration.


  • 0

#6 Larry

Larry

    Administrator/Writer

  • Administrators
  • 3,721 posts
  • LocationState College, PA (USA)

Posted 5 September 2012 - 8:07 AM

Excellent. Thanks for sharing that!
  • 0





Also tagged with one or more of these keywords: phpmyadmin, password