##login to the DB
mariadb -h 172.16.201.150 -u root -p ##if remote
mariadb -u root -p ##if on db vm

##initialize databses with usernames and passwords
##Forgjo Prod
CREATE DATABASE fj_prod CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'fj_prod'@'%' IDENTIFIED BY 'FJPASS2026Prod!';
GRANT ALL PRIVILEGES ON fj_prod.* TO 'fj_prod'@'%';
FLUSH PRIVILEGES;

##Forgjo Test
CREATE DATABASE fj_test CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'fj_test'@'%' IDENTIFIED BY 'FJPASS2026Test!';
GRANT ALL PRIVILEGES ON fj_test.* TO 'fj_test'@'%';
FLUSH PRIVILEGES;

##Forgjo Dev - with applied limits
CREATE DATABASE fj_dev CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'fj_dev'@'%' IDENTIFIED BY 'FJPASS2026Dev!'
    WITH MAX_QUERIES_PER_HOUR 1000
    MAX_UPDATES_PER_HOUR 500;
GRANT ALL PRIVILEGES ON fj_dev.* TO 'fj_dev'@'%';
FLUSH PRIVILEGES;

##Guacamole Prod
CREATE DATABASE guac_prod CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'guac_prod'@'%' IDENTIFIED BY 'GuacPASS2026Prod!';
GRANT ALL PRIVILEGES ON guac_prod.* TO 'guac_prod'@'%';
FLUSH PRIVILEGES;

##Guacamole Test
CREATE DATABASE guac_test CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'guac_test'@'%' IDENTIFIED BY 'GuacPASS2026Test!';
GRANT ALL PRIVILEGES ON guac_test.* TO 'guac_test'@'%';
FLUSH PRIVILEGES;

##Guacamole Dev
CREATE DATABASE guac_dev CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'guac_dev'@'%' IDENTIFIED BY 'GuacPASS2026Dev!'
    WITH MAX_QUERIES_PER_HOUR 1000
    MAX_UPDATES_PER_HOUR 500;
GRANT ALL PRIVILEGES ON guac_dev.* TO 'guac_dev'@'%';
FLUSH PRIVILEGES;