0

When I try to insert data in my server I get the following error:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'sg2nlddb5002-03.shr.prod.sin2.secureserver.net' (111) in /home/content/02/11649702/html/dbcon.php on line 2

Could not connect: Can't connect to MySQL server on 'sg2nlddb5002-03.shr.prod.sin2.secureserver.net' (111)

It works fine on my localhost. I am using php and mysql.

This is the link on my server that gives this error: http://spectrumenglishcourse.com/FRM_Words.php

I have spent the last two hours trying everything from trying to edit my.cnf and what not. Pleaaase help

000
  • 26,951
  • 10
  • 71
  • 101
Laura
  • 27
  • 2
  • 6
  • `secureserver.net`...if my memory serves me correctly this is GoDaddy. If you've specified username and password correctly, it might be best to just ask their support directly. (I am assuming the HTTP server is also GoDaddy and most likely the same server. If you're trying to access the MySQL server from the public internet it will not work) – lc. Sep 09 '13 at 04:50
  • Have you changed the passwords in your code to the username/password that is accepted by the new host? Do you have the right account to access it? – Fluffeh Sep 09 '13 at 04:50
  • You can't connect to the hosted server from your local machine; because it is not configured to allow access from the Internet. – Burhan Khalid Sep 09 '13 at 04:51
  • Port 1433 is not open on sg2nlddb5002-03.shr.prod.sin2.secureserver.net – dcaswell Sep 09 '13 at 04:53
  • http://support.godaddy.com/help/article/173/can-i-connect-to-my-database-remotely *Can I connect to my database remotely? Yes, you can connect to your database remotely with paid hosting accounts. To connect remotely, the Allow Direct Database Access option must be enabled when the database is set up.* – ta.speot.is Sep 09 '13 at 04:56
  • Yes it is GoDaddy. If MySQL server is not accessible from public internet what should I do? I have changed the username and password to the one accepted by the new host. I have uploaded the files from my local machine to the hosted server and changed all the variables accordingly. And what port should I use? The database has already been designed on the hosted server. I have just created the UI in my local machine and uploaded it to server, but data insertion gives error. I appreciate your help. – Laura Sep 09 '13 at 05:16
  • Thanks the problem is solved. I was using the wrong name as the hostname. – Laura Sep 09 '13 at 05:32
  • 1
    I'm voting to put on hold since the problem of a wrong hostname isn't of wide interest to Stack Overflow's long-term audience. Pleased you fixed it though! – halfer Sep 09 '13 at 05:35
  • I think you shouldn't put it on hold since sometimes the solution could be something so simple and yet for the "same" error message I was googling and exploring numerous websites and even going to the extent of downloading putty and trying to edit the my.cnf file. – Laura Sep 09 '13 at 05:39

0 Answers0