Login to Website

Login dengan Facebook

 

Post Reply
Thread Tools
  #1  
Old 20th November 2011
JagoVB
Ceriwiser
 
Join Date: Nov 2011
Posts: 508
Rep Power: 14
JagoVB mempunyai hidup yang Normal
Default [ASK::PHP] Connect Database di Server Lain

gan mohon bantuan.. gimana yah caranya connect MySQL database yang servernya ada di tempat lain..

jadi misal app PHP ane di taro di server 192.168.1.141 (server lokal)

terus connect ke MySQL yang di taro di server (contoh) 112.78.131.2 (server public)

ane udah coba2 dari tadi gak bisa2




Spoiler for error:






Error has found in script C:\xampp\htdocs\product-info\src\class\MySQL.php::43

Datetime : 23 Sep 2011 / 18:18:07

Error message : mysqli_connect() [function.mysqli-connect]: Premature end of data (mysqlnd_wireprotocol.c:554)



Error has found in script C:\xampp\htdocs\product-info\src\class\MySQL.php::43

Datetime : 23 Sep 2011 / 18:18:07

Error message : mysqli_connect() [function.mysqli-connect]: OK packet 1 bytes shorter than expected



Error has found in script C:\xampp\htdocs\product-info\src\class\MySQL.php::43

Datetime : 23 Sep 2011 / 18:18:07

Error message : mysqli_connect() [function.mysqli-connect]: (HY000/2000): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file











yang ane bingung dari error yang ketiga MySQL di server 112.78.131.2 itu MySQL 5.0 terus PHP yang ane pake tuh PHP 5.3..

dan kalo ane access pake MySQL Workbench mau connect




Spoiler for Sepenggal Code:







PHP Code:




require (__BASE_CLASS__ .'/Database.php');



abstract class
MySQL implements Database {

/**

* Method for connecting to SQL

*/

public static function connect() {

self::$link = mysqli_connect(self::$_host,

self::$_user,

self::$_pass,

self::$_db);

if (!
self::$link) {

die(
'Failed to connect Database '. self::$_db .' at '. self::$_host);

}

return
self::$link;

}

}

















mohon bantuannya mastah



Sponsored Links
Space available
Post Reply




Switch to Mobile Mode

no new posts