How do I reset $wp_query in a function?

There’s nothing to reset here. wp_reset_postdata() is only required if you’re using $posts->the_post() or otherwise modifying the global $post variable.

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