add database install scripts
This commit is contained in:
parent
86f56d6d73
commit
abeb23e90b
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$mariadb_version" != 'latest' ] ; then
|
||||
echo 'ERROR: unable to install MariaDB - only '"'latest'"' version currently supported'
|
||||
exit 30
|
||||
fi
|
||||
|
||||
_mysql_cmd="mysql -uroot -e "
|
||||
|
||||
ssh -T $ssh << EOSSH
|
||||
if mysql --version ; then
|
||||
echo "ERROR: unable to install MariaDb, 'mysql' already installed - aborting install"
|
||||
exit 35
|
||||
fi
|
||||
echo "Installing MariaDB"
|
||||
|
||||
apt install -y mariadb-server
|
||||
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
||||
$_mysql_cmd "DROP DATABASE IF EXISTS test;"
|
||||
$_mysql_cmd "DELETE FROM mysql.db WHERE Db='test' OR Db='"'test\\_%'"'"
|
||||
|
||||
mysqladmin --user=root password "$db_root_pass"
|
||||
mysqladmin --user=root --password="$db_root_pass" flush-privileges
|
||||
EOSSH
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$mysql_version" != 'latest' ] ; then
|
||||
echo 'ERROR: unable to install MySQL - only '"'latest'"' version currently supported'
|
||||
exit 30
|
||||
fi
|
||||
|
||||
_mysql_cmd="mysql -uroot -e "
|
||||
|
||||
ssh -T $ssh << EOSSH
|
||||
if mysql --version ; then
|
||||
echo "ERROR: unable to install MySQL, 'mysql' already installed - aborting install"
|
||||
exit 35
|
||||
fi
|
||||
echo "Installing MySQL"
|
||||
|
||||
apt install -y mysql-server
|
||||
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
||||
$_mysql_cmd "DROP DATABASE IF EXISTS test;"
|
||||
$_mysql_cmd "DELETE FROM mysql.db WHERE Db='test' OR Db='"'test\\_%'"'"
|
||||
|
||||
mysqladmin --user=root password "$db_root_pass"
|
||||
mysqladmin --user=root --password="$db_root_pass" flush-privileges
|
||||
EOSSH
|
Loading…
Reference in New Issue