I have created a shell script as given below.The aim is to create a database in a remote machine and give all privileges on that database for a specific user in remote machine.
The shell script is as follows.
ssh [email protected] 'echo "db name :";
read db_name;
echo "db user :";
read db_user;
echo "user password:";
read password;
host=localhost;
sql1="create database $db_name;";
sql2="grant all on ${db_name}.* to ${db_user}@${host} identified by "${password}";";
sql3="${sql1}${sql2}";
mysql -u root -p -e "${sql3}";
'
And the output Iam getting is as foloows
[email protected]'s password:
db name :
amblex
db user :
qbadmin
user password:
xxxx
Enter password: xxxx
ERROR 1064 (42000) at line 1: 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 'qburst'
at line 1
What could be the mistake in my script.PLease help me to resolve this.
Thanks in advance.