rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked

If I had to guess?

The plugin activation hook is firing before the rewrite_rules_array filter is applied, resulting in the rules being flushed before you make changes to them.

See here for the Codex-recommended implementation, using the wp_loaded action hook.

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