Failed to ConnectSQLState[HY000][2002]

I had my website on a VPS on XAMPP and the database there too on NaviCat. I`ve moved the website on the WebHosting, got the SSL but it`s running very slow and sometimes i get the error Failed to ConnectSQLState[HY000][2002]. The database is still on the VPS. Why is my website running very slow with this error after i moved it here?