how to access the $query variable inside taxonomy-xxx.php template file?

Is the my_pagination() call within the same file as your $query declaration?

If not, you need to put global $query; at the top of your template file where my_pagination() is being called.

If this doesn’t solve it, please give some more information/code examples.

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