I want to use the database in remote hosting using PHP PDO.
I need to access the database on b.com
from a.com
.
a.com
was allowed on b.com
on cPanel.
When I run the following code:
$db = new PDO("mysql:host=b.com;dbname=dbtest;charset=utf8;port=3306", "b_root", "toor");
The error went out as follows.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'b_root'@'my.hostingservice.com' (using password: YES)' in /home...
Although the host expresses b.com
, the user is looking for my.hostingservice.com
.
Can you help?