Previously I was using both the M1 and M2 database in the same host.
Now I have given the M1 hostname to different server -- after changing I am connection time out.
Mysql credentials of M1 are working on MySQL workbench application and verified that the username password and host are correct.
We wonder if you have already enabled remote MySQL database connection to your Magento 1 database? You can check out Magento guide to set up MySQL database connection here.
Meanwhile, please note it’s a better option in terms of performance if you connect directly to your databases in the same MySQL server rather than via remote connection.