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)) {