gpt4 book ai didi

mysql - RSpec 测试 - Mysql2::Error::ConnectionError

转载 作者:行者123 更新时间:2023-11-29 17:11:39 25 4
gpt4 key购买 nike

看起来我的 mysql2 gem 连接到数据库有困难。我可以使用其他 mysql 客户端工具轻松连接到 mysql 数据库。我检查了用于 RSpec 的数据库连接字符串,它是正确的。运行 a_spec.rb 规范文件时出现以下错误。

Failure/Error: @db_client = DBClient.new
Mysql2::Error::ConnectionError:
SSL connection error: error:00000001:lib(0):func(0):reason(1)
# ./vendor/cache/ruby/2.3.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `connect'
# ./vendor/cache/ruby/2.3.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `initialize'
# ./helpers/db_client.rb:9:in `new'
# ./helpers/db_client.rb:9:in `initialize'
# ./v1/agent_summary_data_spec.rb:9:in `new'
# ./v1/agent_summary_data_spec.rb:9:in `block (3 levels) in <top (required)>'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `load'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:28:in `run'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/cli.rb:424:in `exec'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/cli.rb:27:in `dispatch'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/cli.rb:18:in `start'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
# /Users/.rvm/gems/ruby-2.3.4/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'

我在我的机器上运行以下版本的 mysql

$ mysql --version
mysql Ver 8.0.12 for osx10.12 on x86_64 (Homebrew)

我正在使用以下 gem

$ gem which mysql2
/Users/.rvm/gems/ruby-2.3.4/gems/mysql2-0.5.2/lib/mysql2.rb

知道会发生什么吗?想知道是否有人遇到过类似的问题。谢谢!

最佳答案

最终,我能够解决上述 SSL 问题。我所做的就是使用以下命令卸载并重新安装 mysql2 gem。它发挥了魔力。

bundle exec gem uninstall mysql2

bundle install

关于mysql - RSpec 测试 - Mysql2::Error::ConnectionError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51863664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com