Mangatsu / server

🌕 Media server for storing, tagging and viewing doujinshi, manga, art collections and other galleries with API and user control. Written in Go.
GNU General Public License v3.0
43 stars 6 forks source link

Initialize database and database user on first launch if needed #22

Open CrescentKohana opened 2 years ago

CrescentKohana commented 2 years ago

Initialize database and database user on first launch if needed. Also an environmental to disable this should be present.

For example for MySQL/MariaDB it'd be:

CREATE USER '<USERNAME>'@'<ADDRESS>' IDENTIFIED BY '<PASSWORD>';
CREATE DATABASE IF NOT EXISTS <DATABASE_NAME> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES on <DATABASE_NAME>.* to '<USERNAME>'@'<ADDRESS>';
FLUSH privileges;

The utf8mb4 COLLATE utf8mb4_unicode_ci helps with support for Japanese, Chinese etc. characters.