where should I write constants in wordpress?

Depends on what your project is. If you’re developing a theme you would define them at the top of your theme’s functions.php file, and if you were developing a plugin you would put them at the top of your main plugin file.

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