Spidy has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to build a CGI system of sorts that is pseudo portable. I have an install script, install.cgi, which the user runs and inputs the values for the main page template, help page template, etc. However, I'm wondering: how can I grab the actual code that my script would need to connect to their MySQL database?

If I browse the control panel on my website, I have stuff like this:
$dbh = DBI->connect("DBI:mysql:***_CTR:localhost","***_CTR","<PASSWORD + HERE>");
But how would I go about getting that exact piece of code on another person's server?

Also, how would I connect to their database without having to have the user hard-input the exact name and information on it? (I am going to have the user input their database password though; can't do anything without that!)

Replies are listed 'Best First'.
Re: Grabbing MySQL Connect Code?
by BUU (Prior) on Nov 20, 2005 at 04:33 UTC
    You just need to know username, password, database name and, optionally, a host for the database. These should all be questions you ask the user. There's no good way to do this without asking them.
      Alright. Would there be any way for me to create a database on their server, and then the tables inside it? I know how to create tables inside an already made database, but not how to create the database without them creating it for me.