feat: implement MariaDbOperationService for database management and add MariaDB configuration template
This commit is contained in:
@@ -3,8 +3,8 @@ port={{PORT}}
|
||||
datadir="{{DATADIR}}"
|
||||
tmpdir="{{DATADIR}}"
|
||||
socket="{{SOCKET}}"
|
||||
character-set-server=utf8mb4
|
||||
collation-server=utf8mb4_unicode_ci
|
||||
character-set-server=utf8
|
||||
collation-server=utf8_unicode_ci
|
||||
log-error="{{LOG_FILE}}"
|
||||
|
||||
# Performance & Scale Optimizations
|
||||
@@ -20,5 +20,5 @@ innodb_default_row_format=DYNAMIC
|
||||
[client]
|
||||
port={{PORT}}
|
||||
socket="{{SOCKET}}"
|
||||
default-character-set=utf8mb4
|
||||
default-character-set=utf8
|
||||
max_allowed_packet=1G
|
||||
|
||||
@@ -103,7 +103,7 @@ export class MariaDbOperationService {
|
||||
|
||||
async createDatabaseAndUser(config: MariaDbConfig, dbName: string, user: string, pass: string): Promise<{ success: boolean; message: string }> {
|
||||
const queries = [
|
||||
`CREATE DATABASE IF NOT EXISTS \`${dbName}\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`,
|
||||
`CREATE DATABASE IF NOT EXISTS \`${dbName}\` CHARACTER SET utf8 COLLATE utf8_unicode_ci;`,
|
||||
`CREATE USER IF NOT EXISTS '${user}'@'%' IDENTIFIED BY '${pass}';`,
|
||||
`GRANT ALL PRIVILEGES ON \`${dbName}\`.* TO '${user}'@'%';`,
|
||||
`FLUSH PRIVILEGES;`
|
||||
|
||||
Reference in New Issue
Block a user