[英]ruby mysql wrong number of arguments
I have installed mysql v2.8.1 with ruby v 1.9.3p125. 我已经用ruby v 1.9.3p125安装了mysql v2.8.1。
When I try and connect to a mysql database with: 当我尝试使用以下方法连接到mysql数据库时:
m = Mysql.new('localhost','root','','dbname')
I get the following error message: 我收到以下错误消息:
in `initialize': wrong number of arguments(4 for 0) (ArgumentError)
I have tested that mysql is installed by checking gem list and also by issuing the command require 'mysql' from the irb prompt which shows "true". 我已经通过检查gem列表并通过从显示“ true”的irb提示符下发出命令require'mysql'来测试是否安装了mysql。
I have also uninstalled and installed mysql a number of times and tried to install using the instructions shown here: http://thinlight.org/2010/05/12/how-to-install-ruby-mysql-on-mac-os-x-10-6-snow-leopard/ 我还多次卸载和安装了mysql,并尝试按照此处显示的说明进行安装: http : //thinlight.org/2010/05/12/how-to-install-ruby-mysql-on-mac-os -x-10-6-雪豹/
Does anyone have any other suggestions to try? 有人还有其他建议可以尝试吗?
尝试改用mysql2 gem的 v0.3.11
I found the solution. 我找到了解决方案。 I added 'export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"' to my .bash_profile and it worked.
我在.bash_profile中添加了“ export DYLD_LIBRARY_PATH =“ / usr / local / mysql / lib:$ DYLD_LIBRARY_PATH””,它可以正常工作。 – pdoak Jun 12 at 16:49
– pdoak 6月12日16:49
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.