dingus Posted October 24, 2007 Share Posted October 24, 2007 hey i am haveing an issue connecting to a mysql database i get the following error Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /home/cutencud/public_html/testing.php on line 1 now testing.php only has one line and it looks like this <?php mysql_connect("66.97.165.60", "root", "") ?> anyone know what would cause that? (and i removed the password before posting Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/ Share on other sites More sharing options...
adam291086 Posted October 24, 2007 Share Posted October 24, 2007 change the code to this $con = mysql_connect("66.97.165.60","username","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); } ?> then run test.php by itself without call upon the file and see what happens. I am new at this so bear with me. Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376875 Share on other sites More sharing options...
dingus Posted October 24, 2007 Author Share Posted October 24, 2007 ok we didnt learn that much new output is Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /home/cutencud/public_html/testing.php on line 2 Could not connect: Lost connection to MySQL server during query which dosent realy give us much more infomration but it was a good idea thanks somthing more interesteing is that the same script works fine localy on the server any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376881 Share on other sites More sharing options...
adam291086 Posted October 24, 2007 Share Posted October 24, 2007 mmmm after looking at another forum i have found out That error indicates that php is trying to connect to the database locally. Are you sure you used the remote IP in your mysql_connect? Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376882 Share on other sites More sharing options...
dingus Posted October 24, 2007 Author Share Posted October 24, 2007 yah i am connecting from 74.53.102.242 to 66.97.165.60 when connecting from 66.97.165.60 to 66.97.165.60 it works just fine but from its current location it dose not Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376885 Share on other sites More sharing options...
adam291086 Posted October 24, 2007 Share Posted October 24, 2007 are you using your own server or one from a seperate company? Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376886 Share on other sites More sharing options...
dingus Posted October 24, 2007 Author Share Posted October 24, 2007 the sql server is my own the php file is running from shared hosting..... basicly what i an trying to do is port the database over th the VPS i am useing and point the scripts there at the new database move the files over that way while i wait for dns to update (After changeing it) i have both sites live on one database so there will be no problem Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376890 Share on other sites More sharing options...
adam291086 Posted October 24, 2007 Share Posted October 24, 2007 ok, are you sure the machine that has the sql server is setup to allow connections externally. If you can run the script from the host machine and not from a remote machine it suggests there is a problem with either the firewall or the sql server setting. But i am not sure to be honest. Try google Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376893 Share on other sites More sharing options...
dingus Posted October 24, 2007 Author Share Posted October 24, 2007 well i tryed google but to top it all off i can access the other database from home so i got no idea now Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376895 Share on other sites More sharing options...
adam291086 Posted October 24, 2007 Share Posted October 24, 2007 ok well make sure the setting on each database are the same Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376896 Share on other sites More sharing options...
dingus Posted October 24, 2007 Author Share Posted October 24, 2007 its the same file on 3 servers the code you gave me local works home works but the remote dose not (and its the one i realy need to work) Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376906 Share on other sites More sharing options...
adam291086 Posted October 24, 2007 Share Posted October 24, 2007 well there is a problem with the remote server settings. Do you have access to get the DNS settings? edit not the dns settings sorry i mean the database settings. Quote Link to comment https://forums.phpfreaks.com/topic/74568-lost-connection-to-mysql-server-during-query/#findComment-376909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.