mysql建库建表插入数据

时间:2022-02-14 04:51:00

#!/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