It all leads to an error being generated.
What error is that exactly? I unfortunately don't have a MySQL instance handy here, but I do see that in DBRun("SET SESSION block_encryption_mode='aes-128-cbc'; SELECT ID, ... you are trying to run two SQL statements at once, which isn't supported by default, you should try splitting that into two DB calls.
In general, your code structure could be cleaned up a bit. For example, you use the older style calling of functions &DBCredentials, instead DBCredentials() is recommended nowadays. Declaring all your variables at the top of the script doesn't help much in achieving proper scoping - e.g. instead of having sub DBConnect set the $dbh variable that is outside its scope, you could have it return the new handle instead. Also, you unconditionally call &DBConnect; at the beginning of sub DBRun and DBDo, when it would make more sense to connect only once at the beginning of the script. Lastly but probably most importantly, instead of interpolation ("...(Password,'$Set{AESKey}', ...") you should use placeholders - see Bobby Tables.
I don't know what your reasons are for storing passwords encrypted - why are you not hashing them instead?