I need to get username, password etc from the wp-config
file to connect to a custom PDO database.
Currently I have another file where I have this info, but
I would just include the file then I would have access to the variable in it varibales.
This is assuming you're on the same server and you can access wp-config.php through the file system.
If you're doing this for a plugin, these values are already available. You won't need to include the file again.