Giter Site home page Giter Site logo

Comments (6)

gie777 avatar gie777 commented on May 14, 2024

@VeblenXSYK 我是看的gorm的文档学的..... Conf 是看的toml 然后,解析配置文档,注册数据库,.就可以了,如果连不行你可以打印一个err

from kratos.

VeblenXSYK avatar VeblenXSYK commented on May 14, 2024

@gie777
我单步调试通过sql.NewMySQL(dc.Demo),没有出现数据库连接出错的信息,但是我在mysql.toml中的数据库配置是故意写错的,所以觉得很奇怪

from kratos.

gie777 avatar gie777 commented on May 14, 2024

@gie777
我单步调试通过sql.NewMySQL(dc.Demo),没有出现数据库连接出错的信息,但是我在mysql.toml中的数据库配置是故意写错的,所以觉得很奇怪

我没用他们写的基础库,我用的orm gorm自己拼的.....你可以看一下基础库你打一下断点,看是不是少判断错误语句了,而且你执行,ping 的时候才会调用mysql 你写model逻辑了么...

from kratos.

VeblenXSYK avatar VeblenXSYK commented on May 14, 2024

@gie777
明白了,是我的理解出了问题,我之前认为“只要kratos运行起来,且没有出现数据库连接错误,就说明数据库已经成功连接了,所以通过show processlist会查看到新的连接”,其实kratos只是在需要进行数据库操作的时候才真正的进行数据库的连接。另外决定数据库的正确连接与toml配置文件中的addr无关,所以错误的修改也不影响数据库的连接

from kratos.

wujunze avatar wujunze commented on May 14, 2024

试一下 Ping 会连接数据库

from kratos.

wujunze avatar wujunze commented on May 14, 2024

我现在遇到一个问题 toml配置 mysql连接的 ip 是127.0.0.2 报错信息里面一直是 172.19.0.1
项目全局搜索这个 172.19.0.1 也没有发现 是什么原因 @Terry-Mao

from kratos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.