Ben uzak bir MySQL veritabanına bağlanmak için gereken ve aşağıdaki bağlantı kodu oluşturduk:
<?php
/* Set Variables */
$host="myipaddress";
$db="mydbname";
$username="dbuser";
$pass="mypass";
/* Attempt to connect */
$mysqli=new mysqli($host,$username,$pass,$db);
if (mysqli_connect_error()){
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
echo 'Success... ' . $mysqli->host_info . "\n";
$mysqli->close();
}
?>
Güvenlik nedenleriyle, ben asıl değişken değerlerini temin ettik. Benim geliştirme sistemine bu çalıştırdığınızda, ben almak
Connect Error (2003) Can't connect to MySQL server on 'myipaddress' (10061)
Benim PHP benim kod hatalı birisi olduğu tespit edebilir, biraz Paslı? Bu dbuser değişken olarak belirlenen veritabanı adını seçin, ekleme ve güncelleme ayrıcalıkları vardır unutmayın.
Thanks, Sid
Edit I made changes to my.cnf and restarted mysql. I now receive access denied for user 'dbuser'@'mycurrenthostname' (using password YES). When I use mysql -u dbuser -p from command line, I can login. I granted insert, update and select to dbuser with host '%' so that dbuser could connect from anywhere.
Ben bu hata ile ilgili MySQL Başvuru kılavuzunu okudum, ama yine şaşırıp. , Şimdi bu my.cnf sabit olmuştur benim koduyla ilgili bir sorun var mı?