简体   繁体   English

Ruby MySQL错误的参数数量

[英]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.

相关问题 在ruby中连接到mysql会产生错误数量的参数错误(4之0)-如何调试? - Connecting to mysql in ruby produces wrong number of arguments error (4 of 0) - how to debug? Angular,Flask,mysql.connector编程错误:参数数量错误 - Angular, Flask, mysql.connector ProgrammingError: Wrong number of arguments Sinatra:参数数量错误(0..2为4) - Sinatra: wrong number of arguments (4 for 0..2) “参数数量错误(2为1)(ArgumentError)”的问题 - Problems with “wrong number of arguments (2 for 1) (ArgumentError)” MySQL NOT IN返回错误的数字 - MySQL NOT IN return a wrong number 无法将Scrapy项目用作MySQL.execute的数据:“字符串格式化期间参数数量错误” - Unable to use Scrapy item as data for MySQL.execute: “Wrong number of arguments during string formatting” mysql.connector.errors.ProgrammingError:字符串格式化期间参数数量错误 - mysql.connector.errors.ProgrammingError: Wrong number of arguments during string formatting 将MySQL Limit参数转换为数字 - Convert MySQL Limit arguments to number MySQL IN 子句:最大参数数 - MySQL IN clause: max number of arguments ProgrammingError:字符串格式化过程中的参数数量错误 - ProgrammingError: Wrong number of arguments during string formatting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM