November 22nd, 2000, 02:36 PM
Who knows the statement to create a MySQL database using PERL+DBI.
The method using PHP is :
But I don't know the method of PERL+DBI
November 22nd, 2000, 04:27 PM
Creating a new Database through Perl DBI
I am also facing a problem in creating a new database through the Perl DBI. I am using DBD-mysql. I know that the command to create a database in mysql is CREATE DATABASE DATABASE_NAME; , but the problem is I dont know, how to create it through the perl script using DBI.
Can anyone please help me out? Is it actually possible to create a database like that?
July 21st, 2009, 10:34 PM
Originally Posted by poojasreejith
Perhaps you should just connect to the standard 'mysql' db that
holds the 'db' and 'users' tables, then create the database using
'$dbh->do' and then add permissions to the 'mysql' db 'db' and
'users' tables so the database can be accessed via the new
permissions set in the 'mysql' db...
Have a nice one
July 21st, 2009, 11:16 PM
It's too late. He's been fired already.
July 27th, 2009, 01:40 AM
January 10th, 2013, 05:13 PM
Here's the real and easy solution.
Just leave the database out:
So do this:
$dbh = DBI -> connect("dbi:mysql::$host", $user, $password);
$dbh -> do("CREATE DATABASE $database");
instead of this:
$dbh = DBI -> connect("dbi:mysql:$database:$host", $user, $password);