cool-admin-3.x
介绍
先在数据库手动建立数据库
- 数据库名称:cool-admin
- 基字符集:utf8mb4
- 数据库排序规则:utf8mb4_general_ci
修改数据库配置,配置文件位于src/config/config.local.ts
数据库为 mysql(>=5.7版本),node 版本(>=12.x),首次启动会自动初始化并导入数据
config.orm = {
type: "mysql",
host: "127.0.0.1",
port: 3306,
username: "root",
password: "root",
database: "cool-admin",
synchronize: true,
logging: true,
};
前后端安装项目依赖
推荐使用 yarn:
yarn
解决 node-sass 网络慢的方法:
yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
后端需要单独安装依赖 axios、node-xlsx
- cd /home/cool/server
- npm i axios
- npm install node-xlsx --save
运行应用程序
yarn dev
表编码格式不一致导致报错解决办法
- SHOW CREATE TABLE shuyou_rent_computer_usage;
- ALTER TABLE shuyou_rent_computer_usage DEFAULT CHARACTER SET utf8mb4 COLLATE=utf8mb4_general_ci;
- ALTER TABLE shuyou_rent_computer_usage CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;