in reply to Re^2: DBD::mysql::db do failed: You have an error in your SQL syntax;
in thread DBD::mysql::db do failed: You have an error in your SQL syntax;

Thanks rnewsham. It worked like a champ Modified code
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; } }
  • Comment on Re^3: DBD::mysql::db do failed: You have an error in your SQL syntax;
  • Download Code