I'm trying to bootstrap a mysql using a rudimentary bash script
cat <<EoF > /tmp/mysql-load-table.sql
CREATE DATABASE IF NOT EXISTS `web_customer_tracker`;
USE `web_customer_tracker`;
DROP TABLE IF EXISTS `customer`;
CREATE TABLE `customer` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
LOCK TABLES `customer` WRITE;
INSERT INTO `customer` VALUES
(1,'JeanLuc','Picard','picard@tng.com'),
(2,'William','Riker','riker@tng.com'),
(3,'Beverly','Crusher','crusher@tng.com'),
(4,'Geordi','LaForge','laforge@tng.com'),
(5,'Data','Android','data@tng.com');
UNLOCK TABLES;
EoF
The above works fine if I enter these commands directly into MySQL, however when I run it as part of a bash script, I get the below errors
-bash: web_customer_tracker: command not found
-bash: web_customer_tracker: command not found
-bash: customer: command not found
-bash: customer: command not found
-bash: customer: command not found
-bash: first_name: command not found
-bash: last_name: command not found
-bash: email: command not found
-bash: customer: command not found
-bash: customer: command not found
-bash: customer: command not found
Can't figure out what am I missing here, any help would be appreciated. I want to create this as SQL script and then pass it to mysql to create database and load it with data.