Fix MariaDB connection to use Unix socket
This commit is contained in:
@@ -5,15 +5,11 @@ class MariaDBHelper {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.connection = null;
|
this.connection = null;
|
||||||
this.config = {
|
this.config = {
|
||||||
host: 'localhost',
|
socketPath: '/run/mysqld/mysqld10.sock',
|
||||||
port: 3306,
|
|
||||||
user: 'jaryo_user',
|
user: 'jaryo_user',
|
||||||
password: 'JaryoPass2024!@#',
|
password: 'JaryoPass2024!@#',
|
||||||
database: 'jaryo',
|
database: 'jaryo',
|
||||||
charset: 'utf8mb4',
|
charset: 'utf8mb4'
|
||||||
timezone: '+09:00',
|
|
||||||
acquireTimeout: 60000,
|
|
||||||
timeout: 60000
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +17,7 @@ class MariaDBHelper {
|
|||||||
try {
|
try {
|
||||||
if (!this.connection || this.connection.connection._closing) {
|
if (!this.connection || this.connection.connection._closing) {
|
||||||
this.connection = await mysql.createConnection(this.config);
|
this.connection = await mysql.createConnection(this.config);
|
||||||
console.log('✅ MariaDB 연결 성공');
|
console.log('✅ MariaDB 연결 성공 (Unix Socket)');
|
||||||
}
|
}
|
||||||
return this.connection;
|
return this.connection;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Reference in New Issue
Block a user