问题描述
本地mysql版本8.0.21, 安装egg-mysql后,也配置好了,启动项目就报错. 终端内可以连接mysql及操作数据库,workbench也可以链接. 就在yarn dev启动项目报错, 把config.detail.js下的mysql下的app改成false,就正常启动了.
config/plugin.js
‘use strict’;
const path = require(‘path’);
exports.validate = {
enable: true,
package: ‘egg-validate’,
};
exports.ejs = {
enable: true,
package: ‘egg-view-ejs’,
};
exports.auth = {
enable: false,
path: path.join(__dirname, ‘…/lib/plugin/egg-auth’),
};
exports.mysql = {
enable: true,
package: ‘egg-mysql’,
};
config/config.detail.js
/* eslint valid-jsdoc: “off” */
‘use strict’;
const path = require(‘path’);
/**
@param {Egg.EggAppInfo} appInfo app info
/
module.exports = appInfo => {
/*
built-in config
@type {Egg.EggAppConfig}
**/
const config = exports = {};
config.auth = {
exclude: [ ‘/home’, ‘/user’, ‘/login’, ‘logout’ ],
};
config.mysql = {
app: true,
agent: false,
client: {
host: '127.0.0.1',
port: '3306',
user: 'root',
password: 'root',
database: 'egg',
},
};
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + ‘_1602639504560_5566’;
// add your middleware config here
config.middleware = [ ‘httpLog’ ];
config.httpLog = {
type: ‘all’,
};
// add your user config here
const userConfig = {
// myAppName: ‘egg’,
};
config.security = {
csrf: {
enable: false,
},
};
config.view =