ZKEACMS 数据库配置

ZKEACMS 数据库配置

ZKEASOFT September 22, 2017


ZKEACMS Core 使用EF Core访问数据库,也因此支持所有EF支持的数据库,但默认我们仅支持了目前比较流行的如:MsSql,MySql,SQLIte。接下来我们看一下数据库的链接字符串应该要如何配置

appsettings.json

打开appsettings.json,Database节点就是用于设置数据库类型和连接字符串的。

DbType

可选值有 MsSql,Sqlite,MySql。MsSql支持的最低版本是2012:

"Database": {
    "DbType": "MsSql",
    "ConnectionString": "Server=(local);Database=ZKEACMS_Enterprise;User Id=sa;Password=sa;"
}

ConnectionString

数据库连接字符串的值。如

MsSql

Server=(local);Database=ZKEACMS_Enterprise;User Id=sa;Password=sa;

Sqlite

Data Source=App_Data/Database.sqlite

MySql

Server=localhost;Database=ZKEACMS_Ultimate;User Id=root;Password=root;

其它

如果你是在Linux上使用MySQL,因为MySQL在Linux环境是区分大小写的,可能会遇到找不到表的情况。这时可以使用IsLowerCaseTableNames来将表名转为小写:

"Database": {
  "DbType": "MySql",
  "ConnectionString": "Server=localhost;Database=ZKEACMS;User Id=root;Password=root;",
  "IsLowerCaseTableNames": true
}


  • 毛毛虫 - 2/18/2021 5:34 AM

    类似织梦cms的备份还原有没有?

    回复

微信公众号