我尝试用crystalmysql连接kemal框架。这是我的碎片:
mysql:
github: crystal-lang/crystal-mysql
db:
github: crystal-lang/crystal-db
这是我的联系:
db = DB.open "mysql://root:password@localhost:787878/book"
但是,如果我在跑步 crystal src/book.cr
我有一个错误:
Unhandled exception: (DB::ConnectionLost)
from lib/mysql/src/mysql/read_packet.cr:16:7 in 'initialize'
from lib/mysql/src/mysql/read_packet.cr:6:3 in 'new'
from lib/mysql/src/mysql/connection.cr:77:5 in 'build_read_packet'
from lib/mysql/src/mysql/connection.cr:59:5 in 'read_packet'
from lib/mysql/src/mysql/connection.cr:22:19 in 'initialize'
from lib/mysql/src/mysql/connection.cr:4:3 in 'new'
from lib/mysql/src/mysql/driver.cr:3:5 in 'build_connection'
from lib/db/src/db/database.cr:51:9 in '->'
from lib/db/src/db/pool.cr:255:3 in 'build_resource'
from lib/db/src/db/pool.cr:17:34 in 'initialize'
from lib/db/src/db/pool.cr:15:5 in 'new:initial_pool_size:max_pool_size:max_idle_pool_size:checkout_timeout:retry_attempts:retry_delay'
from lib/db/src/db/database.cr:50:7 in 'initialize'
from lib/db/src/db/database.cr:43:5 in 'new'
from lib/db/src/db.cr:139:5 in 'build_database'
from lib/db/src/db.cr:135:5 in 'build_database'
from lib/db/src/db.cr:103:5 in 'open'
from src/news_monitoring.cr:13:1 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'
from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'
from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
from __libc_start_main
from _start
from ???
我怎么能修好它。
暂无答案!
目前还没有任何答案,快来回答吧!