php - MySQL Error 111 Can't connect to server -
i have connection.php file suppose connect remote database. here code:
<?php try { $conn = new pdo('mysql:host=ip;port=port;dbname=dbname', 'username', 'password'); } catch (pdoexception $e) { print "error!: " . $e->getmessage() . "<br/>"; die(); } ?>
now variables believe correct since can connect database through toad. used same pdo format own database connection through localhost , works fine. not sure problem is. since can use toad believe server allows remote access it, not sure on that. input nice.
also error pdoexception coming with:
sqlstate[hy000] [2003] can't connect mysql server on 'ip' (111)
111 means connection refused,
it means mysql server listening localhost
interface.
if have lines :
skip-networking bind-address = 127.0.0.1
you should comment them in my.cnf configuration file (add # @ beginning of lines), , restart mysql.
Comments
Post a Comment