Connecting to remote mysql works in terminal, not via PHP PDO script -


i facing weird problem here have server app files stored , b server database

tried connect via command prompt server b using command

mysql -h xx.xx.xx.xx -u root -p password - , worked  

now tried create php script in server connect server b command

$this->db=new pdo('mysql:host=xx.xx.xx.xx;dbname=databasename','root','password'); 

connection failed: sqlstate[hy000] [2003] can't connect mysql server on 'xx.xx.xx.xx' (13) fatal error: uncaught exception 'exception' message 'sqlstate[hy000] [2003] can't connect mysql server on 'xx.xx.xx.xx' (13)'

unable find solution on this.

can on this?

thank you

i got working running command in database server :)

setsebool httpd_can_network_connect_db=1 

thanks replies yycdev


Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -