WordPress Install and Database on separate hosting?

Yes – absolutely. Simply enter the appropriate hostname and credentials in wp-config.php. Instead of the default localhost use the hostname provided by your database provider.

Example:

define( 'DB_HOST', 'mysql.example.com:3307' );

https://codex.wordpress.org/Editing_wp-config.php#Set_Database_Host

tech