简单数据库及表创建shell脚本

来源:互联网 发布:淘宝化妆品开店要求 编辑:程序博客网 时间:2024/06/02 18:37
#!/bin/bashUSER='root'PASS='123'mysql -u $USER -p$PASS <<EOF 2> /dev/nullcreate database test1;EOF[ $? -eq 0 ] && echo "The database Created test1" || echo "The database test1 is already exist"mysql -u $USE test1 <<EOF 2> /dev/nullcreate table test1(ind int,name varchar(20));EOF[ $? -eq 0 ] && echo "The table Created test1" || echo "The table test1 is already exist"mysql -u $USER -p$PASS test1 <<EOFDELETE FROM test1;EOF


原创粉丝点击