exclude certain categories from posts

exclude in get_posts() refers to post IDs, they are not interchangeable with category IDs.

The argument you are looking for is probably 'category__not_in' => [ 8 ]

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