Which action is triggered before final output?

I often use template_redirect. You can also try wp. List of WP Actions

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