You can write a php file with just MySQL connection detail and store it as connection.php. And then you can include it in every php file that requires to connect to the DB using the
<?php require_once("connection.php")<br mode="hold" /?>
You can make use of
<?php include("connection.php")<br mode="hold" /?>
too but this might error out some time with Too many connection error.
As the scripts are not readable from the browser in txt mode you don't have to worry about the security issues too.