How to check current user before all actions and filters?

I solved the issue by putting all the actions and filters inside plugins_loaded which fires very early. Like this:

add_action('plugins_loaded', function(){
      if ($this->is_user_b2b()){
            add_action(.....
            add_filter(.....

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