Files
daydream/config/setup-database.sql
T
2026-09-03 18:28:33 +02:00

25 lines
980 B
SQL

-- Bootstrap for a fresh MyThoughts install.
--
-- Only the database and its user are created here. The schema itself is not in
-- this file on purpose: Main::install() builds it from the table description in
-- MyThoughts::getSqlOptions(), so the structure has exactly one definition and
-- a migration can never drift from it. On first run the app finds an empty
-- database and installs itself.
--
-- Run as an administrator:
-- mariadb -u root -p < config/setup-database.sql
--
-- Then put the same credentials in config/settings.php.
CREATE DATABASE IF NOT EXISTS `mythoughts`
DEFAULT CHARACTER SET utf8mb4
DEFAULT COLLATE utf8mb4_general_ci;
CREATE USER IF NOT EXISTS 'mythoughts'@'localhost' IDENTIFIED BY 'mythoughts';
-- ALL on the one schema, which also lets the app create and drop it during a
-- first-run install without handing it rights over anything else on the server.
GRANT ALL PRIVILEGES ON `mythoughts`.* TO 'mythoughts'@'localhost';
FLUSH PRIVILEGES;