나는이 질문을 여기 저기에 몇 번이나 발견했지만 아무도 나를 도왔다.원격 서버에 로컬 서버 연결
그래서 로컬 아파치 + 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의 연결을 허용 할 필요가 당신에게
에 대한 고정 또는 DHCP 주소 예약이 필요 서버에 직접 연결할 수 있습니다. – Nazariy
맞습니까? 나는 원격 연결 설정이 잘되어야한다고 생각하지만 여기에 문제가 무엇인지 몰랐다. 고정 문자열을 echo하는 대신에 – Tom
대신에 "if (! $ connection) {die (mysql_error());} –