sub create_database { print "Please enter the hostname:"; chomp($hostname = <STDIN>); print "Please enter the name of the new MySQL database:"; chomp($database = <STDIN>); $dsn = "dbi:$driver::$hostname:$port"; print "Please type the MySQL root username:"; chomp($username = <STDIN>); print "Please type the MySQL root password:"; chomp($password = <STDIN>); $dbh = DBI->connect($dsn, $username, $password); $result = $dbh->do("create database `$database`"); $dbh->do("use `$database`"); if($result) { say "Database '$database' created successfully"; } else { say "Database '$database' creation failed"; exit; } }
In reply to Re^3: DBD::mysql::db do failed: You have an error in your SQL syntax;
by shajiindia
in thread DBD::mysql::db do failed: You have an error in your SQL syntax;
by shajiindia
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |