Modifying mysql.sh add support of installation on a remote sql server
This commit is contained in:
parent
5ccb3558b9
commit
249f24658e
|
@ -59,6 +59,20 @@ CREATE DATABASE IF NOT EXISTS $database; "
|
||||||
grant_mail="GRANT ALL ON $database.dovecot_view TO '$alternc_mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$alternc_mail_password';"
|
grant_mail="GRANT ALL ON $database.dovecot_view TO '$alternc_mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$alternc_mail_password';"
|
||||||
grant_mail=$grant_mail"GRANT SELECT ON $database.* TO '$alternc_mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$alternc_mail_password';"
|
grant_mail=$grant_mail"GRANT SELECT ON $database.* TO '$alternc_mail_user'@'${MYSQL_CLIENT}' IDENTIFIED BY '$alternc_mail_password';"
|
||||||
|
|
||||||
|
|
||||||
|
#if mysql_client != localhost means we are connecting to a remote server
|
||||||
|
#the remote sql use rshould already be configured but it is a way of confirming it.
|
||||||
|
if [ $MYSQL_CLIENT != "localhost" ]; then
|
||||||
|
mysql="/usr/bin/mysql -h$host -u$user -p$password"
|
||||||
|
if ! $mysql << EOF
|
||||||
|
$grant
|
||||||
|
EOF
|
||||||
|
then
|
||||||
|
echo "Fail"
|
||||||
|
echo "Can't grant to remote system user $user, aborting";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
echo -n "Trying debian.cnf: "
|
echo -n "Trying debian.cnf: "
|
||||||
mysql="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
mysql="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
||||||
# If this call fail, we may be connected to a mysql-server version 5.0.
|
# If this call fail, we may be connected to a mysql-server version 5.0.
|
||||||
|
@ -95,6 +109,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
echo "ok!"
|
echo "ok!"
|
||||||
|
|
||||||
if [ -f $MYSQL_CONFIG ]; then
|
if [ -f $MYSQL_CONFIG ]; then
|
||||||
|
|
Loading…
Reference in New Issue