Is there a (offical) way for a theme to deactivate itself and show a message in admin?

There’s the check_theme_switched() function.

Checks if a theme has been changed and runs ‘after_switch_theme’ hook on the next WP load

Note: The action has one argument, named $old_theme that you can access. After running the filter, the option theme_switched gets set to true.

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