-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmysql.sh
executable file
·20 lines (20 loc) · 1.01 KB
/
mysql.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
#
# AUTHOR - Raman Sailopal
#
# Automated script to allow remote access to local mysql instance and import the Philance database structure
#
pass=$(awk '/root_password/ { print $2 }' /etc/openproject/installer.dat)
mysql --user=root --password=$pass -e "SHOW DATABASES;" | grep -q "philance"
if [[ "$?" == "1" ]]
then
mysql --user=root --password=$pass < /opt/openproject/public/Philance/SQL_Tables.sql
mysql --user=root --password=$pass < /opt/openproject/public/Philance/SQL_Insert.sql
mysql --user=root --password=$pass -e "GRANT ALL PRIVILEGES ON philance.* TO 'philance'@'%' IDENTIFIED BY 'ph1ldb' WITH GRANT OPTION;"
mysql --user=root --password=$pass -e "GRANT ALL PRIVILEGES ON philance.* TO 'philance'@'localhost' IDENTIFIED BY 'ph1ldb' WITH GRANT OPTION;"
fi
mysql --user=root --password=$pass -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;"
if test -f /opt/openproject/public/Philance/mysql.sql
then
mysql --user=root --password=$pass < /opt/openproject/public/Philance/mysql.sql
fi