jeudi 21 juillet 2016

PHP MySQL: Remote connection access denied from mysql_connect but from client is ok

I've got problem with connection to mysql base via php, i can connect to database via mysql client application without any problems but mysql_connect all the time showing access denied.

  • I've got local mysql server on windows
  • static ip
  • opened port 3306
  • added port rules in windows firewall (also tried with firewall disabled)
  • mysql user with all granted (flushed privileges)
  • binded address in my.ini to my server ip

and f.e. application dbforge studio for mysql (mysql client app) can connect without any problems and mysql_connect in php can't.

$sql_connect = mysql_connect("mystatic_ip", "user", "pass");
echo mysql_errno() . ": " . mysql_error(). "n";
$sql_selected = mysql_select_db("database");

Another strange thing is that i'm trying to connect from different network/machine and the error displays 'localhost'

    1045: Access denied for user 'root'@'localhost' (using password: YES)

Any suggestions?

Aucun commentaire:

Enregistrer un commentaire