Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
angelsonearth

Unable To Connect To Phpmyadmin

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...