From c0e3af63c1ce0ad4a8a9628da4e83331d3195d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B05BEE13=2E=E5=8D=A2=E9=83=B4=E7=BE=A4?= Date: Mon, 23 Nov 2020 13:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=87=AA=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bootstrap/worker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bootstrap/worker.js b/src/bootstrap/worker.js index 5b6be2a..75f49ed 100644 --- a/src/bootstrap/worker.js +++ b/src/bootstrap/worker.js @@ -1,5 +1,11 @@ // invoked in worker +const { execSync } = require('child_process'); think.beforeStartServer(async () => { + try { + execSync('service mysql start', { stdio: ['inherit', 'inherit', 'inherit'] }); + } catch (error) { + console.log("beforeStartServer", error); + } const username = 'test'; let user = await think.model("users").where({ username }).find(); if (think.isEmpty(user)) {