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

Problems with the Windows version of XAMPP, questions, comments, and anything related.

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

Postby carlos1787 » 11. November 2011 16:12

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
carlos1787
 
Posts: 4
Joined: 11. November 2011 12:31
Operating System: Windows 7 64 Bit

Re: Cant connect to MySql database

Postby Sharley » 11. November 2011 23:53

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Cant connect to MySql database

Postby carlos1787 » 12. November 2011 00:55

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
carlos1787
 
Posts: 4
Joined: 11. November 2011 12:31
Operating System: Windows 7 64 Bit

Re: Cant connect to MySql database

Postby Sharley » 12. November 2011 01:04

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Cant connect to MySql database

Postby carlos1787 » 12. November 2011 01:14

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
Last edited by Sharley on 12. November 2011 01:51, edited 2 times in total.
Reason: Adobe installation entries removed to protect the OP.
carlos1787
 
Posts: 4
Joined: 11. November 2011 12:31
Operating System: Windows 7 64 Bit

Re: Cant connect to MySql database

Postby Sharley » 12. November 2011 01:22

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Cant connect to MySql database

Postby carlos1787 » 12. November 2011 01:26

will do..
and it works, thanks
carlos1787
 
Posts: 4
Joined: 11. November 2011 12:31
Operating System: Windows 7 64 Bit

Re: Cant connect to MySql database

Postby Sharley » 12. November 2011 01:35

You're welcome Carlos and thanks for the feedback. 8)

Best wishes. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 108 guests