Adding 'c.default_db ~= ""' for default DB check seems to solve the problem:
-- if client and server db don't match, adjust the server-side -- -- skip it if we send a INIT_DB anyway if cmd.type ~= proxy.COM_INIT_DB and c.default_db and c.default_db ~= "" and c.default_db ~= s.default_db then print(" server default db: '" .. s.default_db .. "'") print(" client default db: '" .. c.default_db .. "'") print(" syncronizing") proxy.queries:prepend(2, string.char(proxy.COM_INIT_DB) .. c.default_db)