Jump to content
php.lv forumi

MySQL kļūda


xfr33

Recommended Posts

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/akcijukl/public_html/roocopy/mysql/connect.php on line 8

Lost connection to MySQL server at 'reading initial communication packet', system error: 111

 

Kāds var izskaidrot, kas tā ir par kļūdu un kā to labot?

Link to comment
Share on other sites

connect.php 8 līnija ir parastākā konekcija mysql datubāzei.

 

<?php
$host = "kkadshostings";
$sqlusername = "kkadsusername";
$sqlpassword = "parole";
$db = "datubaze";
$conn = mysql_connect("$host", "$sqlusername", "$sqlpassword")or die(mysql_error());
mysql_select_db("$db")or die("cannot select DB");
mysql_query( "SET NAMES UTF8", $conn);
?>

Link to comment
Share on other sites

<?php
$host = "kkadshostings";
$sqlusername = "kkadsusername";
$sqlpassword = "parole";
$db = "datubaze";
mysql_connect($host, $sqlusername, $sqlpassword)or die(mysql_error());
mysql_select_db($db)or die("cannot select DB");
mysql_query( "SET NAMES UTF8");
?>

Pamēģini šādi:

<?php
$host = "kkadshostings";
$sqlusername = "kkadsusername";
$sqlpassword = "parole";
$db = "datubaze";
mysql_connect($host, $sqlusername, $sqlpassword)or die(mysql_error());
mysql_select_db($db)or die("cannot select DB");
mysql_query( "set names utf8");
?>

Edited by Kemito
Link to comment
Share on other sites

Un kāds bija risinājums?

Risinājums: hostinga serveris bija localhost nevis adrese, kas man personīgi likās saprotamāka, piemēram, pagezone.lv

Nezinu kāpēc tā tas ir uzstādīts, bet kursa biedrs šādu risinājumu iedeva un aizgāja.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...