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

Avi lists at avi.co
Fri Jul 1 17:03:37 UTC 2011


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'.



-- 
Avi




More information about the ubuntu-users mailing list