1. [python] view plaincopyprint?  
  2. #!/bin/bash     
  3.     
  4. USER='root'    
  5. PASS='123'    
  6.     
  7. mysql -u $USER -p$PASS <<EOF 2> /dev/null    
  8. create database test1;    
  9. EOF    
  10.     
  11. [ $? -eq 0 ] && echo "The database Created test1" || echo "The database test1 is already exist"    
  12.     
  13. mysql -u $USE test1 <<EOF 2> /dev/null    
  14. create table test1(    
  15. ind int,    
  16. name varchar(20)    
  17. );    
  18. EOF    
  19.     
  20. [ $? -eq 0 ] && echo "The table Created test1" || echo "The table test1 is already exist"    
  21.     
  22. mysql -u $USER -p$PASS test1 <<EOF    
  23. DELETE FROM test1;    
  24. EOF