shell鍒涘缓鏁版嵁搴撶殑鑴氭湰
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell鍒涘缓鏁版嵁搴撶殑鑴氭湰相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/root' title='root'>root
exit pass fail sql data 鍒涘缓 port cte1 !/bin/bash 2 3 4 HOSTNAME="localhost" 5 PORT="3306" 6 USERNAME="root" 7 PASSWORD="1234" 8 DBNAME="mydatabase" 9 10 11 LOGIN_CMD="mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD}" 12 13 14 echo ${LOGIN_CMD} 15 16 17 create_database() { 18 echo "create database ${DBNAME}" 19 create_db_sql="create database if not exists ${DBNAME} character set utf8" 20 echo ${create_db_sql} | ${LOGIN_CMD} 21 22 23 if [ $? -ne 0 ] 24 then 25 echo "create database ${DBNAME} failed..." 26 exit 1 27 else 28 echo "succeed to create database ${DBNAME}" 29 fi 30 } 31 32 33 create_database
以上是关于shell鍒涘缓鏁版嵁搴撶殑鑴氭湰的主要内容,如果未能解决你的问题,请参考以下文章
NMPA | 鍖荤枟鍣ㄦ鍞竴鏍囪瘑鏁版嵁搴撶殑鏌ヨ涓庝笅杞?鍚暟鎹簱蹇嵎鍏ュ彛)