I’ve never seen an install script that actually creates a database for you. If that’s truly the case, then you would be correct in saying you’d have to first “create the database manually”.
With that out of the way, any install script I’ve ever seen needs to be fed your DB details, hostname, database name, username and password in order to connect. THEN they will take that info, connect to your database and build the tables for the application
I think you’re confusing what an installation script does. To do as you suggested the script would still need details about where to find the database server, and your shell user account name and password.