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

Phalcon changed my mysql database host address and can't connect to db.

PDOException: SQLSTATE[28000] [1045] Access denied for user 'username'@'x.x.x.206' (using password: YES)

but I set host is x.x.x.117.

so why phalcon said the host is x.x.x.206?

and you can see the screen shot here: https://www.awesomescreenshot.com/image/189837/39318c098c8da4ffeca70615b4993a32

so, why I can't use $db = new \Phalcon\Db\Adapter\Pdo\Mysql() to connect my db?

The ip in the error is not the database one, but the client's.

That means that you are trying to connect to the database from the x.x.x.206 ip, and you don't have the privileges to do so. You'll have to grant privileges to the username from that ip.



5.2k

But my ip address is :x.x.x.96

and also,x.x.x.206 and x.x.x.117 alsmost the same what different is just the last number,

The ip in the error is not the database one, but the client's.

That means that you are trying to connect to the database from the x.x.x.206 ip, and you don't have the privileges to do so. You'll have to grant privileges to the username from that ip.

I mean that the client trying to connect to the database is x.x.x.206. That would be the server where you are executing the phalcon application, not your local machine.

Is the database in the same server than the application?



5.2k

the phalcon application ip is x.x.x.243 and database is in another server.

But I can connect to database with normal PHP script.

I mean that the client trying to connect to the database is x.x.x.206. That would be the server where you are executing the phalcon application, not your local machine.

Is the database in the same server than the application?

Ok, no clue then what's your problem. What one thig is for sure: that error on your first post is not issued by Phalcon, but by the MySQL server.



5.2k

But where does ip x.x.x.206 come from?

Ok, no clue then what's your problem. What one thig is for sure: that error on your first post is not issued by Phalcon, but by the MySQL server.

As I said, that should be the ip of the client trying to connect to MySQL. I cannot see from here what's happening in your local network :)



5.2k

I found that I can conenct to database vai new mysqli(), but can't with new PDO().

so, any sugestion ?

As I said, that should be the ip of the client trying to connect to MySQL. I cannot see from here what's happening in your local network :)