Comments (6)
@VeblenXSYK 我是看的gorm的文档学的..... Conf 是看的toml 然后,解析配置文档,注册数据库,.就可以了,如果连不行你可以打印一个err
from kratos.
@gie777
我单步调试通过sql.NewMySQL(dc.Demo),没有出现数据库连接出错的信息,但是我在mysql.toml中的数据库配置是故意写错的,所以觉得很奇怪
from kratos.
@gie777
我单步调试通过sql.NewMySQL(dc.Demo),没有出现数据库连接出错的信息,但是我在mysql.toml中的数据库配置是故意写错的,所以觉得很奇怪
我没用他们写的基础库,我用的orm gorm自己拼的.....你可以看一下基础库你打一下断点,看是不是少判断错误语句了,而且你执行,ping 的时候才会调用mysql 你写model逻辑了么...
from kratos.
@gie777
明白了,是我的理解出了问题,我之前认为“只要kratos运行起来,且没有出现数据库连接错误,就说明数据库已经成功连接了,所以通过show processlist会查看到新的连接”,其实kratos只是在需要进行数据库操作的时候才真正的进行数据库的连接。另外决定数据库的正确连接与toml配置文件中的addr无关,所以错误的修改也不影响数据库的连接
from kratos.
试一下 Ping 会连接数据库
from kratos.
我现在遇到一个问题 toml配置 mysql连接的 ip 是127.0.0.2 报错信息里面一直是 172.19.0.1
项目全局搜索这个 172.19.0.1 也没有发现 是什么原因 @Terry-Mao
from kratos.
Related Issues (20)
- Unable to customize http.ResponseWriter because of wrong implementation of Kratos' http.wrapper.Result() HOT 4
- Test failed on different time zone. HOT 1
- [consul Registry]: When grpc enters idle mode, “last connection error” occurs on the client and cannot be recovered HOT 1
- [Question]Why design middleware after bind? HOT 1
- [Question] Shall we follow the behavior of the document of http.ResponseWriter? HOT 1
- kratos run runs successfully but docker run fails HOT 5
- Issue with configuration file to render the values from environment variables HOT 5
- [Question]Use make config under windows to report an error HOT 3
- github.com/go-kratos/kratos/pkg/cache/redis 代码找不到了, 新版位置在哪里啊 HOT 6
- [Feature] log Helper sprint, sprintf is executed before Filter Level, the performance consumption is very high HOT 3
- [Question]Transaction nested conflict stuck HOT 3
- [Feature] consule register need suport tags[] HOT 2
- When the App stops, the ctx in the afterStop callback is not available HOT 3
- [Question] How to return other Status Code in a successful HTTP request? HOT 7
- [Feature] Add Unwrap to custom response writer. HOT 3
- [Proposal] config feature roadmap HOT 22
- [Feature] replace kratos metrics with otel metrics HOT 3
- [The modification of header file information of http response does not take effect] ctx.Header().Set("Content-Type", "application/octet-stream") HOT 5
- [Question] How to return a custom response json? HOT 1
- Package version dependency issue HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kratos.