Page 1 of 1

Cant connect to MySQL database (Win7 64) 1.7.7 [SOLVED]

PostPosted: 11. November 2011 16:12
by carlos1787
I have spent way too much time trying to get his to work. I can't open phpMyAdmin, I get an error #2002 the server is not responding. If i type localhost in my browser (firefox or IE 9) I get nowhere. if I enter 127.0.0.1 I can get to the XAMPP for windows page. under status is shows MySQL database as deactivated, under CD Collection iget the following

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: The requested name is valid, but no data of the requested type was found. in C:\xampp\htdocs\xampp\cds.php on line 78

Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: getaddrinfo failed: The requested name is valid, but no data of the requested type was found. (trying to connect via tcp://localhost:3306) in C:\xampp\htdocs\xampp\cds.php on line 78

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: The requested name is valid, but no data of the requested type was found. in C:\xampp\htdocs\xampp\cds.php on line 78


Could not connect to database!
Is MySQL running or did you change the password.

I am using Control panel v3.0.2 and it shows that both Apache (ports 80,443)and MySQL (port 3306) are running and there is and possible problem listed " possible problem detected: port 80 in use by c:\xampp\xampp\control-3-beta.exe!"
what should I do next?
I'm running win 7 64 bit

Re: Cant connect to MySql database

PostPosted: 11. November 2011 23:53
by Sharley
Open your \Windows\system32\drivers\etc\hosts file in your text editor - you may need to right click on your text editor and select to run as administrator to be able to save this file after editing).

Make sure the first line after the comments is
Code: Select all
127.0.0.1 localhost
Save the file and if possible restart your PC.

Next open in your text editor \xampp\mysql\bin\my.ini file and uncomment (remove the #from the start of the line) si it looks like this
Code: Select all
bind-address="127.0.0.1"
Save the file and restart Apache and MySQL (Stop - make sure they are not running then hit Start and make sure they are both running again).

Clear your browser's cache (Temporary Internet Files) and try again the steps that caused your issues.

Good luck.

Re: Cant connect to MySql database

PostPosted: 12. November 2011 00:55
by carlos1787
Thank you so much Sharley,

when I opened the hosts file I found that there is already another program using the 127.0.0.1 IP address, so I changed the bind-address and hosts file to 127.0.0.2 and this solution worked.

will changing this setting have any other adverse affects?

Again thank you
Carlos

Re: Cant connect to MySql database

PostPosted: 12. November 2011 01:04
by Sharley
Hello Carlos,
If the hosts file already had an uncommented line
Code: Select all
127.0.0.1 localhost
Then that is fine and does not need you to add this entry
Code: Select all
127.0.0.2 localhost


Changing the my.ini file as I suggested by removing the # character in the 127.0.0.1 line should have been all you needed to do.

So go back a step and just do as I suggested in my first post and then see if you have things working.
Post back with the results of doing the changes I suggested before making any other changes.

Re: Cant connect to MySql database

PostPosted: 12. November 2011 01:14
by carlos1787
my hosts file looks like this
0.0.0.0 localhost
[Adobe installation entries removed to protect the OP]
# added by carlos to get MySQL to function

127.0.0.2 localhost

I wasn't sure if adding 127.0.0.1 localhost would break my adobe installation

Re: Cant connect to MySql database

PostPosted: 12. November 2011 01:22
by Sharley
Add
Code: Select all
127.0.0.1 localhost
above the line
Code: Select all
0.0.0.0 localhost
then save the file and do the edit I suggested in the my.ini file and all should be fine and will not affect your Adobe installation lines at all.

Re: Cant connect to MySql database

PostPosted: 12. November 2011 01:26
by carlos1787
will do..
and it works, thanks

Re: Cant connect to MySql database

PostPosted: 12. November 2011 01:35
by Sharley
You're welcome Carlos and thanks for the feedback. 8)

Best wishes. :)