We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How connect to databse via Mysqli in phalcon

How can I connect to my mysql database via

new mysqli()?

https://php.net/manual/en/mysqli.construct.php

because I can't conect via new PDO().

Phalcon only supports PDO, what problem do you have using PDO?



5.2k

I can't access remote mysql.

PDOException: SQLSTATE[28000] [1045] Access denied for user 'user'@'localhost' (using password: NO) .....



43.9k

looks like your db config credentials are wrong.



5.2k

So, if that so, how can I conect remote mysql? any help is apprecaite.

looks like your db config credentials are wrong.



43.9k

Your app is trying to connect to foreign mysql server. And you get: access denied.

  • does your mysql server accept foreign connections (!= localhost) ?
  • are your connections credentials OK ("I can't access remote mysql" with error :"using password: NO") ?


5.2k

I did try to connect another mysql name A via normal php code new PDO(),

it's showing connect success. But when I connect A via Phalcon it said:

PDOException: SQLSTATE[42000] [1044] Access denied for user 'username'@'%' to database 'dbname'

And as for mysql named B neither normal php code nor Phalcon can acccess.



5.2k

I did try to connect another mysql name A via normal php code new PDO(),

it's showing connect success. But when I connect A via Phalcon it said:

PDOException: SQLSTATE[42000] [1044] Access denied for user 'username'@'%' to database 'dbname'

And as for mysql named B neither normal php code nor Phalcon can acccess.

Your app is trying to connect to foreign mysql server. And you get: access denied.

  • does your mysql server accept foreign connections (!= localhost) ?
  • are your connections credentials OK ("I can't access remote mysql" with error :"using password: NO") ?

My Database server is not support mysql, just support mysqli. I run tutorial, it show message "Exception: could not find driver". Please inclue mysqli in phalcon soon. Thanks