Thanks, Kirk. I wrote a quick script and it worked fine.

-----Original Message-----
From: Kirk [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 4:52 PM
To: Ken Hilliard
Cc: [EMAIL PROTECTED]
Subject: RE: [Perl-unix-users] Creating a MYSQL database
programmatically via DBI


perldoc DBD::mysql

and from the above result in the 'admin' section:
...
$rc = $drh->func('createdb', $database, $host, $user, $password, 'admin');
...

and for table creation and in the 'example' section:
...
# Create a new table 'foo'. This must not fail, thus we don't
# catch errors.
$dbh->do("CREATE TABLE foo (id INTEGER, name VARCHAR(20)");
...





Kirk

>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED]]On Behalf Of Ken
>Hilliard
>Sent: Wednesday, January 08, 2003 12:30 AM
>To: [EMAIL PROTECTED]
>Subject: [Perl-unix-users] Creating a MYSQL database programmatically
>via DBI
>
>
>Does anyone know how to create the initial database and tables
>programmatically via DBI under MYSQL. I've been creating the application
>database and required tables using the provided MYSQL utilities and then
>using the Perl DBI to insert/update/delete records. I know that MYSQL's
>command line utility allows you to script database and table creation;
>however, I'd like to generate the database/tables using Perl. I realize the
>solution will be MYSQL specific. It looks like there might be a way of
>creating the database via the database driver handle but I'm not sure.
>
>                                                       Thanks, Ken
>
>_______________________________________________
>Perl-Unix-Users mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to