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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -