mirror of
git://f0xx.org/ac/ac-ms-url-shortener
synced 2026-07-29 02:58:30 +03:00
21 lines
784 B
Bash
Executable File
21 lines
784 B
Bash
Executable File
#!/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;'"
|