lingdu1234 / axum_admin

axum admin rust vue
https://314.iu1314.top/
218 stars 37 forks source link

数据库连接失败 #2

Closed liunn123 closed 1 year ago

liunn123 commented 1 year ago

thread 'main' panicked at '数据库打开失败: Conn("encountered unexpected or invalid data: expected NUL in byte sequence")', F:\rustWork\axum_admin-axum\db\src\db.rs:18:43 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace error: process didn't exit successfully: target\debug\axum-admin.exe (exit code: 101)

我 执行 sea-orm-cli migrate up 报错 could not compile sqlx-macros due to previous error 好像编译不了

于是我就没有执行这个数据库迁移。我在本地弄了一个db 的127 的mysql ,我看了连接信息,没有问题,但是 数据库打开失败, 给点提示,我哪里错误了,

lingdu1234 commented 1 year ago

sea-orm-cli 需要配置 .env文件呢,应该给主程序无关,从这个信息看不出什么

liunn123 commented 1 year ago

我用 postgres 连接 就只报错 thread 'main' panicked at '定时任务初始化失败: Query( "error returned from database: 关系 \"sys_job\" 不存在", 应该是没有那个表,

我的mysql 连接信息 用工具是可以连接上的,但是程序那个mysql 报错感觉像是连接信息不对的时候。

liunn123 commented 1 year ago

有 建表语句 有空了发我一下吗? 我试试去,我用postgres这个试试 smxlnn911201@163.com

lingdu1234 commented 1 year ago

有时间我先测试下,可能是数据库迁移在pgSql下有问题,

liunn123 commented 1 year ago

不不不,这个postgres报错 是因为 我没有这个表。我手动创建这个表,接下来他就报了获取不到菜单这个表。我主要是懒,想让你有空了直接发我建表sql ,而且,我看到代码里面配置文件里面有pem 证书,这个我down下来的里面没有,这个也能发我一下吗?

liunn123 commented 1 year ago

主要是前期 先把项目跑通,然后才慢慢调,mysql 不知道为什么连接失败。数据迁移那个sea-orm-cli我安装不上,报了could not compile sqlx-macros due to previous error,我在https://github.com/launchbadge/sqlx/issues/615,

lingdu1234 commented 1 year ago

证书那个 是我自己域名的证书,没有办法发给你, 把配置里面的ssl关掉就可以了,最好还是用数据库迁移,数据库迁移mysql和pgsql我都测试了没有问题 我备份了 邮件发给你试试

lingdu1234 commented 1 year ago

还有就是 你最好升级下rust版本 很可能是版本太低了 所以 sea-orm-cli 安装不上

liunn123 commented 1 year ago

恩恩,我试试去