Couldn't make a database in mysql using bash script ??

Amrit Pal Pathak amritpalpathak1 at gmail.com
Fri Jul 1 16:55:10 UTC 2011


On Fri, Jul 1, 2011 at 12:48 PM, Amrit Pal Pathak <amritpalpathak1 at gmail.com
> wrote:

>
>
> On Fri, Jul 1, 2011 at 12:40 PM, Avi <lists at avi.co> wrote:
>
>> Amrit Pal Pathak wrote:
>>
>> > I used following code to make a database in mysql through bash
>> > script.but it couldn't make.it opens the mysql server in terminal
>> > just.
>> >
>> > mysql -u root -p
>> > echo  "Enter password"
>> > read a
>> > create database test
>> > echo "press ctrl+d "
>> > echo "bye"
>>
>> Because the
>>
>> mysql -u root -p
>>
>> is the command to get a shell in the mysql client, it's not a
>> programming interface to mysql. The usual way to do this would be to do
>>
>> echo "create database test" | mysql -u root -pPassword
>>    echo "create database test" | mysql -u root -p
>>
>
>
         Now i tried as to pass a root user 's password but it
         says :

          mysql: unknown option '-1'

           echo "pass"
           read a
           echo "create database test" | mysql -u root -$a

          Thanks
           amritpalpathakgne.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110701/d3d09c31/attachment.html>


More information about the ubuntu-users mailing list