cefresh Posted June 4, 2010 Share Posted June 4, 2010 OK so this is my error that I get: Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/jerryc/public_html/highscores/mysql.php on line 8 Attempt to connect has failed. This is the entire php file where it comes from: <?php // MYSQL $pwd = 'highscores123'; $username = 'Jerry'; $database = "highscores"; $host = "disulfiram.x10hosting.com"; mysql_connect($host,$username,$pwd); @mysql_select_db($database) or die( "Attempt to connect has failed."); // CONFIG $ppls_page = "20"; $sig_support = false; $maxhiscorelevel = 99; $sig_image = ""; $top_hiscore = 1000001; $minlvltohiscore = 10; $website = "http://disulfiram.x10hosting.com/highscores"; $webtwo = "http://disulfiram.x10hosting.com/personal"; $images = ""; $file = "highscores.php"; $file2 = "skills.php"; $pers = "personal.php"; // ARRAY REMEMBER ALWAYS START WITH MALL LETTER $webbers = array("N/a"); $admins = array("deathz", "shawn", "mr love"); $mods = array("N/a"); $high_mods = array("N/a"); $donators = array("N/a"); $banned = array("null", "", " "); // ICONS $webbers_icon = "http://img264.imageshack.us/img264/3287/moddws8.gif"; $admins_icon = "http://i7.tinypic.com/8foy68l.gif"; $mods_icon = "http://img264.imageshack.us/img264/3287/moddws8.gif"; $high_mods_icon = "http://img264.imageshack.us/img264/3287/moddws8.gif"; $donators_icon = "http://img243.imageshack.us/img243/5434/donnf7.gif"; // BBCODE $webbers_code = '<img src="http://i46.tinypic.com/357omjp.gif" border="0" />'; $admins_code = '<img src="http://i34.tinypic.com/1zeccg9.jpg" border="0" />'; $mods_code = '<img src="http://i26.tinypic.com/29597ic.jpg" border="0" />'; $high_mods_code = '<img src="http://i34.tinypic.com/1zeccg9.jpg" border="0" />'; $donators_code = '<img src="http://i47.tinypic.com/2643zpc.jpg" border="0" />'; ?> It doesn't matter if the password show cause that's not really it. help please. Quote Link to comment https://forums.phpfreaks.com/topic/203810-mysql-connection-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 4, 2010 Share Posted June 4, 2010 The $host name you use to connect to the database server is not your web address. According to the x10hosting.com KB article, you should be using 'localhost' - http://kb.x10hosting.com/questions.php?questionid=15 Quote Link to comment https://forums.phpfreaks.com/topic/203810-mysql-connection-error/#findComment-1067459 Share on other sites More sharing options...
cefresh Posted June 4, 2010 Author Share Posted June 4, 2010 THANK YOU! I got it working thanks to you! Quote Link to comment https://forums.phpfreaks.com/topic/203810-mysql-connection-error/#findComment-1067465 Share on other sites More sharing options...
cefresh Posted June 4, 2010 Author Share Posted June 4, 2010 Well actually I got it working with MySQL server but I'm trying to make send things from a game server. I still can't be localhost then? Take a look: public static void createConnection() { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost/highscores","jerryc_Jerry","highscores123"); stmt = con.createStatement(); } catch (Exception e) { //e.printStackTrace(); } } Quote Link to comment https://forums.phpfreaks.com/topic/203810-mysql-connection-error/#findComment-1067470 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.