Can not connect to mySQL

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Can not connect to mySQL

Postby KansaiRobot » 25. June 2016 08:45

Hello this is my first post and I would appreciate some help

I have downloaded and install XAMPP 5.6.21-0 on a mac OsX Lion. Total beginner here.
Apparently it is working. Apache is running and I started mySQL.
Since it is first time I was exploring the pages in localhost and I found the phpmyadmin. I couldnt connect when mySQL was not running but when i started it, I could see a control panel.

No problem so far.

It said that it was unsecure and that I should set some password so that is what I did following the instructions

No problem there

but now everytime I want to see that nice control panel in the phpmyadming it says

Welcome to phpMyAdmin

Error

MySQL said: Documentation
Cannot connect: invalid settings.
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.


Well I guess it is obvius since now it has a password but how do you "check the host username and password" and how to I configure that??

Thank you very much for any help you can give me
KansaiRobot
 
Posts: 2
Joined: 25. June 2016 08:38
XAMPP version: 5.6.21-0
Operating System: OsX Tiger

Re: Can not connect to mySQL

Postby Nobbie » 25. June 2016 14:20

KansaiRobot wrote:Well I guess it is obvius since now it has a password but how do you "check the host username and password" and how to I configure that??


Proceed to the phpmyadmin folder, edit file config.inc.php

Watch out for the setting of User/Password, it should look like:

Code: Select all
...
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
...


You see, there is no password applied. Insert your new password between the empty quotes and safe the file. Thats it.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Can not connect to mySQL

Postby KansaiRobot » 25. June 2016 15:03

Thank you very much for your reply! It worked. :)

Actually it was a little more complicated. I will write here what I did in case anyone has the same problem

1> The file is locked so can not be edited. so I went to the folder (phpmyadmin) and selected from the menu File-> Get Info.
2. Went to the sharings & permissions arrow
3. I could see that it was read only for everyone (except system and admin)
4. click the lock in the lower right (probbably it will ask you your password - the one of your user id -not the one you are trying to set
5. modify to read and write. Then click the small button with a setting icon so as to select "apply to enclosed items"
6. Open the file config.inc.php
7. Modify as stated in the previous post
8. it will ask you if to unlock the file. do it
9. save the file and close it
10. go again to the previous get info panel and set for everyone again read only (dont touch the admin and system)
11. repeat the "apply to enclosed items"
12. voila! it is working now!


by the way Nobbie, isn't it a little bit unsecure to put the password on a text file visible to everyone?? just asking, not that it bothers me right now...

thanks again!
KansaiRobot
 
Posts: 2
Joined: 25. June 2016 08:38
XAMPP version: 5.6.21-0
Operating System: OsX Tiger

Re: Can not connect to mySQL

Postby Nobbie » 25. June 2016 15:57

KansaiRobot wrote:by the way Nobbie, isn't it a little bit unsecure to put the password on a text file visible to everyone?? just asking, not that it bothers me right now...


It depends. Is that file visible for everone? Is there any other user than you? It is impossible to read that file via Apache/Internet, as it would be executed by Apache/PHP on any request and there is no output. Therefore, i cannot see how it can be "unsecure"?!

Anyway, if you prefer to hide your UserID and password, you may edit that file again and comment out the User/Password lines (you also may remove the Password and also the "root" from the lines), instead edit the line above which looks like:

Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'config';


and replace 'config' by 'cookie'. If you do so, phpmyadmin will NOT use the User/Password values from this file, instead you will be prompted with a login dialog, where you have to enter the User data. You may use any MySQL User/Password here, but "root" is the only admin out of the box (you may add more users with full access of course):

Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Can not connect to mySQL

Postby Jwerton17 » 07. December 2016 09:37

Thank you both very much for your great posts. I had exactly the same problems you both described and your solutions were quite right. I bow to you both! Happy Holidays! :D
Jwerton17
 
Posts: 1
Joined: 07. December 2016 09:32
XAMPP version: 7.0.13-0
Operating System: OS X 10.11.6


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 6 guests