#! /bin/bash

# check running

# sed -i s@/deb.debian.org/@/mirrors.163.com/@g /etc/apt/sources.list
# apt-get update
# apt-get install -y mysql-client

mysql -uadmin -h140.143.35.79 -P 8886 -pafafa -e "drop DATABASE test_gitlab;"
if [ $? -ne 0 ]; then
    echo "数据库不存在"
fi
mysql -uadmin -h140.143.35.79 -P 8886 -pafafa -e "drop DATABASE gitlab;"
if [ $? -ne 0 ]; then
    echo "数据库不存在"
fi

mysql -uadmin -h140.143.35.79 -P 8886 -pafafa -e "create DATABASE test_gitlab;"
if [ $? -ne 0 ]; then
    echo "test_console数据库创建成功"
fi
mysql -uadmin -h140.143.35.79 -P 8886 -pafafa -e "create DATABASE gitlab;"
if [ $? -ne 0 ]; then
    echo "console数据库创建成功"
fi
