通过shell脚本创建数据库
#!/bin/bashserverIP=10.1.1.196
SERVER_NAME=`echo $serverIP | cut -d '.' -f4`cat<<EOF>db.sql
drop database if exists ${SERVER_NAME}_scheduler;
drop database if exists ${SERVER_NAME}_kms;
drop database if exists ${SERVER_NAME}_uim;
drop database if exists ${SERVER_NAME}_sem;CREATE DATABASE ${SERVER_NAME}_scheduler CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
CREATE DATABASE ${SERVER_NAME}_uim CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
CREATE DATABASE ${SERVER_NAME}_kms CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
CREATE DATABASE ${SERVER_NAME}_sem CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
EOFmysql -h10.1.1.143 -uroot -pxxx < db.sql