Permalinks Works for Custompost type but not with pages Why?

after_setup_theme is the wrong action to register post types. See register_post_type in Codex:

Do not use register_post_type before init.

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