Category page 2 url doesn’t exist

The answer is to use pre_get_posts. See WordPress Pagination not displaying posts after certain page

As Milo says “WordPress determines if a paginated page exists based on the results of the main query”. I was using a custom query that was setting posts_per_page to 5 but in Settings this value was set to 10. Using pre_get_posts this value can be changed for specific circumstances.

I dropped this into the functions.php so the paging on the main query for categories is 5.

function set_number_of_posts($query)
{
  if (!is_admin() && $query->is_main_query() && is_category()) {
    // Display 5 posts on category pages
    $query->set("posts_per_page", 5);
    return;
  }
}
add_action("pre_get_posts", "set_number_of_posts", 1);

and that did the trick.

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