Couldn't make a database in mysql using bash script ??
Amrit Pal Pathak
amritpalpathak1 at gmail.com
Fri Jul 1 17:12:14 UTC 2011
On Fri, Jul 1, 2011 at 1:03 PM, Avi <lists at avi.co> wrote:
> Amrit Pal Pathak wrote:
> > On Fri, Jul 1, 2011 at 12:40 PM, Avi <lists at avi.co> wrote:
> > > echo "create database test" | mysql -u root -pPassword
> > > echo "create database test" | mysql -u root -p
> > >
> > How can i pass the mysql root user's password here
> > ?
> Just put it after the '-p'. Peciliarly for that switch, though, there's
> no space between the p and the password:
> mysql -u root -psomepass
> Will try to log in as root with the password somepass
> mysql -u root -p somepass
> will try to log in as root, prompt for a password, then select the
> database 'somepass'.
> Thanks you very much.
I tried following n it worked.
echo "Enter your mysql's root password"
mysql -uroot -p$r -e "create database kan"
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ubuntu-users