#!/bin/bash
apt-get install mysql-server
export BASE_DIR=`pwd`
mkdir sql
cd sql
wget https://axure.keyersoft.com/download/sql/xxl_job.sql
wget https://axure.keyersoft.com/download/sql/ks_industry_park.sql
wget https://axure.keyersoft.com/download/sql/ks_industry_book.sql
mysql -uroot  -e "CREATE USER 'keyersoft'@'%' IDENTIFIED BY 'Lkgl123456~@123'; GRANT ALL PRIVILEGES ON *.* TO 'keyersoft'@'%'; FLUSH PRIVILEGES;"
mysql -uroot  -e "CREATE DATABASE ks_industry_park  CHARACTER SET utf8mb4   COLLATE utf8mb4_unicode_ci;"
mysql -uroot  -e "CREATE DATABASE xxl_job  CHARACTER SET utf8mb4   COLLATE utf8mb4_unicode_ci;"
mysql -uroot  -e "CREATE DATABASE ks_industry_book  CHARACTER SET utf8mb4   COLLATE utf8mb4_unicode_ci;"
mysql -uroot  xxl_job <  $BASE_DIR/sql/xxl_job.sql
mysql -uroot  ks_industry_park <  $BASE_DIR/sql/ks_industry_park.sql
mysql -uroot  ks_industry_book <  $BASE_DIR/sql/ks_industry_book.sql
sudo mysql_secure_installation
sudo systemctl start mysql
sudo systemctl enable mysql


