sub create_database { print "Please enter the hostname:"; chomp($hostname = ); print "Please enter the name of the new MySQL database:"; chomp($database = ); $dsn = "dbi:$driver::$hostname:$port"; print "Please type the MySQL root username:"; chomp($username = ); print "Please type the MySQL root password:"; chomp($password = ); $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; } } #### ---------------------------------------- S E N N O V A T E I N C SSG Database Utility - Version 1.1 Copyright Sennovate Inc, 2014 ---------------------------------------- M E N U ------- 1. Create new database 2. Connect to existing database 3. Create tables 4. Create user 5. Drop existing database 6. Quit Please enter your choice:1 Please enter the hostname:db0002.stage-us.sennovate.com Please enter the name of the new MySQL database:ssg-secure-test Please type the MySQL root username:ssg-stage Please type the MySQL root password:p7ZUrf59zJHYMMuLKfWTxC DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-secure-test' at line 1 at C:/Users/Sennovate/workspace/Perl/Automation/Sennovate/MySQL DB Creation/ssg-db-utility.pl line 79, line 5. Database 'ssg-secure-test' creation failed DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-secure-test' at line 1 at C:/Users/Sennovate/workspace/Perl/Automation/Sennovate/MySQL DB Creation/ssg-db-utility.pl line 80, line 5.