MySQL客户端库版本不正确!这个gem编译为5.5.28,但客户端库是5.6.22 / Mac OS X / 10.9.5

时间:2014-12-10 22:10:57

标签: mysql sql-server

将我的MAC OS X更新为10.9.5版本后, 我收到以下错误 当试图连接到jdbc时:mysql:// localhost:3306 / my_dat。 (我使用的是NetBeans IDE):

enter image description here

SQL Server正在运行:

enter image description here

连接问题的原因是

 Incorrect MySQL client library version! This gem was compiled for 5.5.28
 but the client library  is 5.6.22.

我已经看过原因和可能的解决方案。我做了以下步骤:

Zoulfias-iMac:~ zoulfiahall$ ls /usr/local/Cellar/mysql
5.6.22
Zoulfias-iMac:~ zoulfiahall$ cd zhall/Myapp
Zoulfias-iMac:Myapp zoulfiahall$ gem install mysql2 
-- --with-mysql-  config=/usr/local/Cellar/mysql/5.6.22/bin/mysql_config
Fetching: mysql2-0.3.17.gem (100%)
Building native extensions with: 
'--with-mysql-  config=/usr/local/Cellar/mysql/5.6.22/bin/mysql_config'
This could take a while...
Successfully installed mysql2-0.3.17
Parsing documentation for mysql2-0.3.17
Installing ri documentation for mysql2-0.3.17
Done installing documentation for mysql2 after 0 seconds
1 gem installed
Zoulfias-iMac:Myapp zoulfiahall$ 

现在的问题是,不知何故需要将选项传递给bundler,为此你可以使用bundler config。

bundle config build.mysql2 --with-mysql-config=/usr/local/Cellar/mysql/5.6.22/bin/mysql_config

不幸的是,收到相同的错误消息:

rake aborted!
Incorrect MySQL client library version! This gem was compiled for 5.5.28 
but the client library     is 5.6.22.
/Users/zoulfiahall/.rvm/gems/ruby-head/ruby/2.2.0/gems/mysql2-0.3.17/lib/
mysql2.rb:8:in `   require'
/Users/zoulfiahall/.rvm/gems/ruby-head/ruby/2.2.0/gems/mysql2-0.3.17/
lib/mysql2.rb:8:in `<top (required)>'
/Users/zoulfiahall/Users/zoulfiahall/.rvm/gems/ruby-head@global/
gems/bundler-  1.6.3/lib/bundler/runtime.rb:76:in `require'
/Users/zoulfiahall/Users/zoulfiahall/.rvm/gems/ruby-head@global/
gems/bundler-  1.6.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/zoulfiahall/Users/zoulfiahall/.rvm/gems/
ruby-head@global/gems/bundler-1.6.3/lib/bundler/runtime.rb:72:in `each'
/Users/zoulfiahall/Users/zoulfiahall/.rvm/gems/ruby-head@global/
gems/bundler-  1.6.3/lib/bundler/runtime.rb:72:in `block in require'
/Users/zoulfiahall/Users/zoulfiahall/.rvm/gems/ruby-head@global/
gems/bundler-1.6.3/lib/bundler/runtime.rb:61:in `each'
 /Users/zoulfiahall/Users/zoulfiahall/.rvm/gems/ruby-head@global/
gems/bundler-1.6.3/lib/bundler/runtime.rb:61:in `require'
/Users/zoulfiahall/Users/zoulfiahall/.rvm/gems/ruby-head@global/
gems/bundler-1.6.3/lib/bundler.rb:132:in `require'
/Users/zoulfiahall/zhall/Myapp/config/application.rb:9:in `<top (required)>'
/Users/zoulfiahall/zhall/Myapp/Rakefile:5:in `<top (required)>'
Click here to rerun the task with tracing enabled

我检查是否可以启动服务器:

  Zoulfias-iMac:Myapp zoulfiahall$ mysql.server start
  Starting MySQL
  SUCCESS! 
  Zoulfias-iMac:Myapp zoulfiahall$ mysql -uroot
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 32
  Server version: 5.6.22 Homebrew

 Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

  Oracle is a registered trademark of Oracle Corporation and/or its
  affiliates. Other names may be trademarks of their respective
  owners.

  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

   mysql> SELECT version();
   +-----------+
   | version() |
   +-----------+
   | 5.6.22    |
   +-----------+
   1 row in set (0.00 sec)

欢迎任何帮助。谢谢。

1 个答案:

答案 0 :(得分:0)

所有问题都与mysql连接器有关。我需要更新它。我使用NetBeans IDE。我刚用新的驱动程序替换了一个旧的mysql驱动程序。我重新启动了我的MySQL服务器。有效。 也许有人会发现我的回答很有帮助。