Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Grabbing MySQL Connect Code?

by Spidy (Chaplain)
on Nov 20, 2005 at 03:53 UTC ( [id://510187]=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://510187]
Approved by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-23 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found