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