siteserver / cms

SS CMS 基于 .NET Core,能够以最低的成本、最少的人力投入在最短的时间内架设一个功能齐全、性能优异、规模庞大并易于维护的网站平台。
https://sscms.com
GNU Affero General Public License v3.0
3.66k stars 1.21k forks source link

SS CMS安装向导-3数据库设置-连接串获取不到,请问是我的环境变量配置错误吗 #2663

Open wyDuang opened 3 years ago

wyDuang commented 3 years ago
sscms:
    image: sscms/core
    container_name: mysscms
    restart: always   
    ports:
      - 5200:80
      - 5201:443
    volumes:
      - ./sscms/wwwroot:/app/wwwroot
    environment:
        SSCMS_SECURITY_KEY: "e2a3d303-ac9b-41ff-9154-930710af0845"
        SSCMS_DATABASE_TYPE: "MySQL"
        DATABASE_HOST: "127.0.0.1"
        DATABASE_PORT: "3306"
        DATABASE_USER: "root"
        DATABASE_PASSWORD: "123456"
        DATABASE_NAME: "SSCMS_Docker"
        DATABASE_CONNECTION_STRING: "server=127.0.0.1;port=3306;database=SSCMS_Docker;uid=root;pwd=123456;SSL Mode=None"
        REDIS_CONNECTION_STRING: "127.0.0.1:6379,password=123456,ssl=false"

image

SS CMS 安装向导 - 3 数据库设置 - 连接字符串读取不到,请问是我上面的环境变量配置错误吗

wyDuang commented 3 years ago

我找到问题了,被你们的文档误导了,环境变量配置参数的前面都应该加上 SSCMS_

- SSCMS_DATABASE_CONNECTION_STRING=server=127.0.0.1;port=3306;database=SSCMS_Docker;uid=root;pwd=123456;SSL Mode=None

- SSCMS_REDIS_CONNECTION_STRING=127.0.0.1:6379,password=123456
wyDuang commented 3 years ago

Sqlserver和mysql链接都报错,我本地测试了都可以连的,真是醉了

Data Source=localhost;Initial Catalog=SSCMS;Persist Security Info=True;User ID=sa;Password=123456 报错: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)

server=localhost;port=3306;database=SSCMS_Docker;uid=root;pwd=123456;Allow User Variables=True 报错: Unable to connect to any of the specified MySQL hosts.

jiangbin4586 commented 3 years ago

默认不需要提前设置数据库的链接啊,直接在安装界面输入就可以啊。

wyDuang commented 3 years ago

默认不需要提前设置数据库的链接啊,直接在安装界面输入就可以啊。

docker启动必须要配置环境变量

Vanmedia commented 3 years ago

我也是相同问题 提示Object reference not set to an instance of an object. 连接字符串 无法获取

starlying commented 3 years ago

我找到问题了,被你们的文档误导了,环境变量配置参数的前面都应该加上 SSCMS_

- SSCMS_DATABASE_CONNECTION_STRING=server=127.0.0.1;port=3306;database=SSCMS_Docker;uid=root;pwd=123456;SSL Mode=None

- SSCMS_REDIS_CONNECTION_STRING=127.0.0.1:6379,password=123456

对,需要加上前缀,我们完善一下文档