Operation mysql linux shell command (not enter mysql interface)

Due to the need, mysql series of operations need to be made into a .sh file, just bash command shell operations can fool a complete black box task.

 

1 1 #!/bin/bash
2 2 mysql -uroot -p??? -e "create database IF NOT EXISTS test_db_test"
3 3 mysql -uroot -p??? -e "use test_db_test;create table IF NOT EXISTS test_table_test ( name varchar(20), id int(11) default 0 );"
4 4 mysql -uroot -p??? -e "use test_db_test;insert into test_table_test values('billchen',2)"

 

 

 

Guess you like

Origin www.cnblogs.com/dhName/p/11864473.html