-
#!/bin/sh
-
HOST=127.0.0.1
-
USER=root
-
PASS=ESBecs00
-
mysql -h$HOST -u$USER -p$PASS << EOF
-
use test;
-
select * from tab1;
-
create table tab1bak as select * from tab1;
-
select * from tab1bak limit 1;
-
exit
-
EOF
-
-
-
info=`mysql -h$HOST -u$USER -p$PASS << EOF
-
use test;
-
select * from tab1;
-
select * from tab1bak limit 1;
-
exit
-
EOF`
- echo $info
[root@localhost /root ]# sh test.sh
Warning: Using a password on the command line interface can be insecure.
id name passwd mima mima2
1 1 1 111 3333333333333
3 3 3 333 3333333333333
4 4 4 5 3333333333333
id name passwd mima mima2
1 1 1 111 3333333333333
Warning: Using a password on the command line interface can be insecure.
id name passwd mima mima2 1 1 1 111 3333333333333 3 3 3 333 3333333333333 4 4 4 5 3333333333333 id name passwd mima mima2 1 1 1 111 3333333333333