I would like to dynamically use a database inside a stored procedure but the
use database_name command is not supported inside procedures.
What alternatives are there?
From MySQL Documentation on Stored Routine Syntax When the routine is invoked, an implicit USE db_name is performed (and undone when the routine terminates). USE statements within stored routines are not permitted
If you need to query tables from other databases you can do it like DBName.TableName. and you can change DBName dynamically.