Switching Databases in LocalHost

just to understand you…
You have a livesite on some host which uses cpanel and you want to revert it back to your local Installation? (e.g. xamp)

I think the easiest way is to use a Backup/Restore plugin. For example Akeeba Backup (free and easy to use). It also helps you to replace permalinks that may have changed.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)