Couldn't make a database in mysql using bash script ??
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 -pecho *"Enter password"
read acreate database testecho "press ctrl+d "echo "bye"
any clue ?*Thanks*
amritpalpathakgne.wordpress.com*
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-01-2011, 04:40 PM
Avi
Couldn't make a database in mysql using bash script ??
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
having previously prompted for the username and password if preferable.
This wont pass you a shell, but it will execute 'create database test'
in one and print whatever output you'd normally get to terminal.
--
Avi
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-01-2011, 04:48 PM
Amrit Pal Pathak
Couldn't make a database in mysql using bash script ??
On Fri, Jul 1, 2011 at 12:40 PM, Avi <lists@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
� � � � How can i pass the mysql root user's �password here ��
� � � � ?� � �
� � �Thanks for support !!!� ��� � amritpalpathakgne.wordpress.com �
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-01-2011, 04:55 PM
Amrit Pal Pathak
Couldn't make a database in mysql using bash script ??
*
On Fri, Jul 1, 2011 at 12:48 PM, Amrit Pal Pathak <amritpalpathak1@gmail.com> wrote:
On Fri, Jul 1, 2011 at 12:40 PM, Avi <lists@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
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-01-2011, 05:03 PM
Avi
Couldn't make a database in mysql using bash script ??
Amrit Pal Pathak wrote:
> On Fri, Jul 1, 2011 at 12:40 PM, Avi <lists@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
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-01-2011, 05:12 PM
Amrit Pal Pathak
Couldn't make a database in mysql using bash script ??
On Fri, Jul 1, 2011 at 1:03 PM, Avi <lists@avi.co> wrote:
Amrit Pal Pathak wrote:
> On Fri, Jul 1, 2011 at 12:40 PM, Avi <lists@avi.co> wrote:
> * * * * 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"* *read r* *mysql -uroot -p$r -e "create database kan"
* *Rocks !!!
* Thanks again
* amritpalpathakgne.wordpress.com*
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users