本文只要介绍如何使用Shell脚本来创建我们想要的数据库,下面给出我创建数据库的Shell脚本,基本也就是将mysql的一些命令放在shell脚本里面而已。
#!/bin/bash
#The username of mysql database
USER="root"
#The password of mysql database
PASS="dragonwake"
#The datebase name will be created
DATABASE="SmartCare"
mysql -u $USER -p$PASS << EOF >/dev/null
CREATE DATABASE $DATABASE
EOF

本文链接:https://it72.com/11702.htm