PHP script can’t connect to Database on port 3307

Try this one. This is connection object created to use in wordpress

$mydb = new wpdb( 'username', 'password', 'my_database', 'localhost' );

and if it is way that you want to go check in codex $wpdb function ‘select’ to select database when do queries. Hope it help.