Refactor the too big copy-database function for MySQL.
Remove some dead code (was intended for later use).
Refactor the dbname API to feed from the connection string directly.
Some more refactoring, MySQL copy-database function is still too big.