mirror of
git://f0xx.org/ac/ac-ms-template
synced 2026-07-29 03:39:28 +03:00
initial
This commit is contained in:
20
skeleton/scripts/init-mariadb-grants.sh
Executable file
20
skeleton/scripts/init-mariadb-grants.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Grant existing androidcast app user access to url_shortener (after schema import as root).
|
||||
# Password is NOT stored here — same as examples/crash_reporter/backend/config/config.php db.mysql.password
|
||||
#
|
||||
# Usage (on BE):
|
||||
# mysql -u root -p < sql/schema.mariadb.sql
|
||||
# ./scripts/init-mariadb-grants.sh
|
||||
set -eu
|
||||
|
||||
DB_NAME="${URL_SHORTENER_DB_NAME:-url_shortener}"
|
||||
DB_USER="${URL_SHORTENER_DB_USER:-androidcast}"
|
||||
|
||||
echo "Granting ${DB_USER}@localhost and @127.0.0.1 on ${DB_NAME}.* ..."
|
||||
mysql -u root -p <<EOF
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON ${DB_NAME}.* TO '${DB_USER}'@'localhost';
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON ${DB_NAME}.* TO '${DB_USER}'@'127.0.0.1';
|
||||
FLUSH PRIVILEGES;
|
||||
EOF
|
||||
|
||||
echo "Smoke: mysql -u ${DB_USER} -p -h 127.0.0.1 ${DB_NAME} -e 'SHOW TABLES;'"
|
||||
Reference in New Issue
Block a user