2012-01-22 4 views
3

나는이 질문을 여기 저기에 몇 번이나 발견했지만 아무도 나를 도왔다.원격 서버에 로컬 서버 연결

그래서 로컬 아파치 + PHP 서버가 있고 원격 mysql 데이터베이스에 연결하려고합니다. 그러나 스크립트가 나에게 오류를 반환하고 오류 로그에 내가 참조 :

PHP Warning: mysql_connect(): Premature end of data (mysqlnd_wireprotocol.c:553) in D:\\_SERVER\\_WWW\\project\\api\\classes\\database.php on line 13 
PHP Warning: mysql_connect(): OK packet 1 bytes shorter than expected in D:\\_SERVER\\_WWW\\project\\api\\classes\\database.php on line 13 
PHP Warning: mysql_connect(): 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 in D:\\_SERVER\\_WWW\\project\\api\\classes\\database.php on line 13 

연결을위한 스크립트를 (단지 부분은 서버에 연결) :

function db_connect(){ 
    // Connect to the database server 
    $connection = mysql_connect("server.com:3306","username","password",true); 
    if (!$connection){ 
     echo "Could not connect to the Database server, please check your settings"; 
     die; 
    } 
... 
} 

나를 위해 작동하지 않았다 암호 설정과 트릭, 누군가 나를 도울 수 있습니까?

는 원격가 서버의 IP 주소에서 들어오는 MySQL의 연결을 허용 할 필요가 당신에게

+0

에 대한 고정 또는 DHCP 주소 예약이 필요 서버에 직접 연결할 수 있습니다. – Nazariy

+0

맞습니까? 나는 원격 연결 설정이 잘되어야한다고 생각하지만 여기에 문제가 무엇인지 몰랐다. 고정 문자열을 echo하는 대신에 – Tom

+0

대신에 "if (! $ connection) {die (mysql_error());} –

답변

0

감사드립니다. 이것은 원격 서버의 MySQL 설정 파일 내에 추가 될 수 있습니다.

구성 파일을 편집하는 방법에 대한 자세한 내용은 여기에서 자세한 지침을 참조하십시오. http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

+0

감사하지만 여전히 동일한 오류가 발생하는 데 도움이되지 않았습니다. – Tom

+0

가능한 해결책을 찾으십시오. http://stackoverflow.com/q/10420831/1031312 – Ozzy

0

서버에 대한 포트 전달하도록 방화벽 요구 사항 : 해당 시스템의 포트, 원격 연결이되지 않을 것 허용되지 않는 경우 MySQL의 서버 시스템

관련 문제