#!/bin/bash user="root" password="123456" mycmd="mysql -u$user -p$password" for dbname in tec stu do $mycmd -e "create database $dbname;" $mycmd -e "use $dbname;create table test(id int,name varchar(18));insert into test values(1,‘rainman‘);" done
#!/bin/bash user="root" password="123456" mycmd="mysql -u$user -p$password" for dbname in tec stu do $mycmd -e "create database $dbname;" $mycmd -e "use $dbname;create table test(id int,name varchar(18));insert into test values(1,‘rainman‘);" done