MT#7053 add database name to the queries. Use auth_sql prosody config.

(cherry picked from commit f53d100842badd0b2b218a37af8c018ab8ab3841)