How to Connect multiple database in WordPress?


Hi everyone, I have been working on a project related to php development and want to know your views on connecting multiple database in a WordPress. I am also very curious about various other php questions and answers because I also got stuck in some coding issues, that is why I am looking for such a platform where the evolving community can help me to resolve my queries.


you can simply create multiply links:

$link1 = mysqli_connect("", "my_user", "my_password", "my_db1");
$link2 = mysqli_connect("", "my_user", "my_password", "my_db2");
$link3 = mysqli_connect("", "my_user", "my_password", "my_db3");

now $link1 will refer to my_db1, $link2 to my_db2 and so on

I never used wordpress, but this how it is done in PHP

Are you sure you want multiply databases not multiply tables in the same DB?