creating a bash script to create database and user automatically
<p>Hi I am trying to create a bash script, which take username and database name and password as in arguments and create a database.</p>

<pre><code>mysql -u xxx -pxxxxxx  &lt;&lt; EOF
CREATE DATABASE '$2';
CREATE USER '$2'@'localhost' IDENTIFIED BY '$3';
GRANT ALL PRIVILEGES ON '$2'.* TO '$2'@'localhost';
EOF
</code></pre>

<p>I am getting mysql 1064 error while executing this command. </p>

<p>Any help will be appreciated. </p>

<p>Thanks</p>