Hi I am trying to create a bash script, which take username and database name and password as in arguments and create a database.
mysql -u xxx -pxxxxxx << EOF
CREATE DATABASE '$2';
CREATE USER '$2'@'localhost' IDENTIFIED BY '$3';
GRANT ALL PRIVILEGES ON '$2'.* TO '$2'@'localhost';
EOF
I am getting mysql 1064 error while executing this command.
Any help will be appreciated.
Thanks