{"id":980,"date":"2022-08-30T15:10:23","date_gmt":"2022-08-30T15:10:23","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/problem-about-mysql2-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:23","modified_gmt":"2022-08-30T15:10:23","slug":"problem-about-mysql2-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-mysql2-collection-of-common-programming-errors\/","title":{"rendered":"problem about mysql2-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0ae66820f7ce27d139c75032f297390f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDrew<br \/>\nruby-on-rails ruby ruby-on-rails-3 rubygems mysql2<br \/>\nWhy would this method (list_id) be undefined when I have the adapter installed?== XXXXX: migrating ========================================&#8211; create_table(:XXXX)&#8211; list_id()rake aborted!An error has occurred, all later migrations canceled:undefined method `list_id&#8217; for #\/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:385:in `block in method_missing&#8217;HERE&#8217;S THE FULL LOAD:undefined method `list_id&#8217; for # \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:385:in `block in method_missing&#8217; \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:361:in `block in say_with_time&#8217; \/Users\/dcarpenter\/.rvm\/rubies\/ruby-1.9.2-p290\/lib\/ruby\/1.9.1\/benchmark.rb:295:in `measure&#8217; \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:361:in `say_with_time&#8217; \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:381:in `method_missing&#8217; \/Users\/dcarpenter\/Dropbox\/workspace\/BlueFusion\/db\/migrate\/20110812030512_create_outreach_campaigns.rb:4:in `block in up&#8217; \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/connection_adapters\/abstract\/schema_statements.rb:157:in `create_table&#8217; \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/mysql2-0.2.11\/lib\/active_record\/connection_adapters\/mysql<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/psFAI.jpg?s=32&amp;g=1\" \/><br \/>\nLinus Caldwell<br \/>\nruby-on-rails rake mysql2 dbmigrate<br \/>\nI&#8217;m new of rails, and i have this big problem. I&#8217;m running rails 3.2.9 and Ruby 1.9.3, I did a porting of a rails app from linux to windows, but in windows i&#8217;m having a lot of problems with mysql2 gem. I installed mysql2 gem yesterday and than i tried to run rake db:migrate but i have this output:rake aborted!Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (cannot load such file &#8212; mysql2)C:\/Users\/RoccaA\/Desktop\/project\/config\/environment.rb:5:in `&#8217;Tasks: TOP =&gt; db:migrate =&gt; environment(See full trace by running task with &#8211;trace)Then this is my Gemfilegem &#8216;rails&#8217;, &#8216;3.2.9&#8217; # Bundle edge Rails instead: # gem &#8216;rails&#8217;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e6a8c04594efffbb1da3de2f263f0060?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nj\u00e4vi<br \/>\nruby-on-rails gem mysql2<br \/>\nI&#8217;m trying to set up my RubyOnRails development enviroment with MySQL. I have XAMPP installed, so I decided to use the XAMPP&#8217;s MySQL installation, (therefore I installed the XAMPP dev package).Now I&#8217;m trying to install the mysql2 gem but I got this error:gem install mysql2 &#8211;version 0.2.7 &#8212; &#8211;with-mysql-dir=\/Applications\/XAMPP\/xamppfiles\/ &#8211;with-mysql-lib=\/Applications\/XAMPP\/xamppfiles\/lib\/mysql\/ \u2013with-mysql-include=\/Applications\/XAMPP\/xamppfiles\/include\/mysql\/ &#8211;with-mysql-config=\/Applications\/XAMPP\/xamppfiles\/bin\/mysql_config Error loading RubyGems plugin &#8220;\/Library\/Ruby\/Gems\/1.8\/gems\/yard-0.6.3\/lib\/rubygems_plugin.rb&#8221;: undefined method `overwrite_accessor&#8217; for Gem::Specification:Class (NoMethodError) Building native extensions. This could take a while&#8230; ERROR: Error installing mysql2:ERROR: Failed to build gem native extension.\/System\/Library\/Frameworks\/Ruby.framework\/Versions\/1.8\/usr\/bin\/ruby extconf.rb &#8211;with-mysql-dir=\/Applications\/XAMPP\/xamppfiles\/ &#8211;with-mysql-lib=\/Applications\/XAMPP\/xamppfiles\/lib\/mysql\/ \u2013with-mysql-include=\/Applications\/XAMPP\/xamppfiles\/include\/mysql\/ &#8211;with-mysql-confi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bb6f9ef4e70a3c2aa4b1c0fa6d614e4e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMrk Fldig<br \/>\nruby gem mysql2<br \/>\nI&#8217;m trying to installing the mysql2 gem on windows 7 I downloaded the connector from the mysql site and placed the libmysql.dll in ruby200\\binthen do gem install mysql2These are the results am I being dim here?Temporarily enhancing PATH to include DevKit&#8230; Building native extensions. This could take a while&#8230; ERROR: Error installing mysql2:ERROR: Failed to b<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5b51732df1273cc8d770b04dcd9bb712?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nweb spider26<br \/>\nruby-on-rails-3 sunspot mysql2 sunspot-rails<br \/>\nPlease any one tell me is it possible put conditions on the associated fields using sunspot solr. I have four models. That is brands, departments, categories and product_details. brands table contains id, name and verified (flag). departments contains id, name. categories contains id and name. product_details contains name, price, image_url, discount, brand_id, department id and category_id. brand.rbclass Brand &lt; ActiveRecord::Basehas_many :product_details, :dependent=&gt;:destroy enddepart<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/eG69F.jpg?s=32&amp;g=1\" \/><br \/>\nFabien Lebas<br \/>\nmysql ruby-on-rails-3 heroku amazon-ec2 mysql2<br \/>\nI&#8217;m installed the Amazon RDS Add-on in Heroku, and created OK an instance in Amazon AWS. But I can&#8217;t run heroku run rake db:migrateIt&#8217;s ending with (&#8230;) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:migrate rake aborted! undefined method<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1074f0a031cca12280359231a87662af?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEric<br \/>\nruby gem mysql2<br \/>\nWhile trying to build the mysql2 gem with ruby 1.9.2-p320 on Fedora 16, I ran into this error, reproducible like so:gremlin:mysql2 $ cat conftest.c#include &#8220;ruby.h&#8221;\/*top*\/int main() {return 0;}int t() {void ((*volatile p)());p = (void ((*)()))rb_thread_blocking_region;return 0;}gremlin:mysql2 $ gcc -o conftest -I\/usr\/local\/include\/ruby-1.9.1\/i686-linux \\-I\/usr\/local\/include\/ruby-1.9.1\/ruby\/backward<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/67ddb32384a4b119e289644190aadad3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nCaio Tarifa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ab65b7140835a42d94115fa78b2c21ec?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHard-Boiled Wonderland<br \/>\nrubygems installation mysql2<br \/>\nI am struggling to install mysql2 gem 0.2.7, this is the output I get:C:\/RailsInstaller\/Ruby192\/bin\/ruby.exe extconf.rb &#8211;with-mysql-dir=X: &#8211;with-mysql-lib=X:\\lib &#8211;no-rdoc &#8211;no-ri checking for rb_thread_blocking_region()&#8230; yes checking for main() in -llibmysql&#8230; yes checking for mysql.h&#8230; yes checking for errmsg.h&#8230; yes checking for mysqld_error.h&#8230; yes creating Makefilemake gcc -I. -IC:\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1\/i386-mingw32 -I\/C\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1\/ruby\/backward -I\/C\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:\/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o client.o -c client.c client.c: In function &#8216;rb_mysql_client_query&#8217;: client.c:361:11: warning: unused variable &#8216;r&#8217; gcc -I. -IC:\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1\/i386-mingw32 -I\/C\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1\/ruby\/backward -I\/C\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:\/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o mysql2_ext.o -c mysql2_ext.c gcc -I. -IC:\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1\/i386-mingw32 -I\/C\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1\/ruby\/backward -I\/C\/RailsInstaller\/Ruby192\/include\/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:\/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o result.o -c result.c result.c: In function &#8216;rb_mysql_result_fetch_fields&#8217;: result.c:318:35: warning: comparison between signed and unsigned integer expressions gcc -shared -s -o mysql2.so client.o mysql2_ext.o result.o -L. -LC:\/RailsInstaller\/Ruby192\/lib -LX:\\lib -LX:\/lib -L. -Wl,&#8211;enable-auto-image-base,&#8211;enable-auto-import mysql2-i386-mingw32.def -lmsvcrt-ruby191 -llibmys<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6df8b5f2a2312628ad92f50b7945dd9f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMichiel de Mare<br \/>\nruby-on-rails rubygems bundler mysql2<br \/>\nI recently upgraded mysql on my machine. As a result I&#8217;m attempting to update my mysql2 gem accordingly. In the process of doing that, I run &#8220;bundle install&#8221;, and for some reason all of the gems in my Gemfile are getting installed in a .\/mysql2 directory?? ruby-1.9.2-p180 [dev]:project.git$ bundle install NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. Gem.source_index called from \/Users\/al\/.rvm\/gems\/ruby-1.9.2-p180\/gems\/bundler-1.0.10\/lib\/bundler\/shared_helpers.rb:3. NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. Gem.source_index called from \/Users\/al\/.rvm\/gems\/ruby-1.9.2-p180\/gems\/bundler-1.0.10\/lib\/bundler\/source.rb:162. NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. Gem::SourceIndex#each called from \/Users\/al\/.rvm\/gems\/ruby-1.9.2-p180\/gems\/bundler-1.0.10\/lib\/bundler\/source.rb:162. NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f46301bba7817f6098df3b0a0ace139b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBrady<br \/>\nruby-on-rails-3 activerecord mysql2<br \/>\nI&#8217;m using Active Admin as my interface for a rails project (client&#8217;s request). The problem is&#8230; most of the tables in my client&#8217;s database have primary k<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9e9e85a1cd09a7004955b0f60162bdf3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nshishirmk<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bedaeefbbe27cf163cf294c2ab332977?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nvosmith<br \/>\nactiverecord ruby-on-rails-3.2 mysql2<br \/>\nI&#8217;m trying to destroy an object using a call similar to MyObject.destroy_all({:user_id =&gt; current_user.id, :item_type_id =&gt; params[:type_id], :item_id =&gt; params[:item_id]})Rails generates this as<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f080a83364d176b8eb3c4009ee3b7bab?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntendril89<br \/>\nruby-on-rails ubuntu gem mysql2<br \/>\nI&#8217;m a Ror newbe and I&#8217;m attempting to create my first webapp with rails. I&#8217;m encountering a problem when I installed gem mysql2: This is my actual configuration:ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]rails -v: Rails 3.2.3gem -v: 1.8.24michele@michele:~\/rails\/my_app$ gem install mysql2 Bu<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0ba9efd64f451323efb01c37ce250e0a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDrew White<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/dcbdba3c4c47c91ec3cab4e6846002f6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsv.luo<br \/>\nruby-on-rails mysql2<br \/>\ni install ror on windows7 with railsintaller2.1.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0c2f75ef598d989d6b947439b151931a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ndaiikota<br \/>\nruby activerecord has-many-through mysql2<br \/>\nI ran into a little problem I have a has_many through relationship here is the code for the modelsclass User &lt; ActiveRecord::Basehas_many :friendshipshas_many :followings, :through =&gt; :friendships, :foreign_key =&gt; &#8220;followed_id&#8221; endclass Friendship &lt; ActiveRecord::Basebelongs_to :user belongs_to :following, :class_name =&gt; &#8220;User&#8221;, :<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/51bbf006002450d264a53bf1afc428a6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJeremy<br \/>\nrake mysql2<br \/>\nI&#8217;m following instructions from a hand-over package from a previous group. I don&#8217;t know too much about rails or mysql2. I am on Windows.When I do:rake db:migrate RAILS_ENV=productionThis is the output:C:\\jcccf-goslowserver-e30bf00&gt;rake db:migrate RAILS_ENV=production (in C:\/jcccf-goslowserver-e30bf00) rake aborted! Unknown database &#8216;goslow_production&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/mysql2-0.2.6-x86-mingw32\/lib\/mysql2\/client.r b:37:in `connect&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/mysql2-0.2.6-x86-mingw32\/lib\/mysql2\/client.r b:37:in `initialize&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/mysql2-0.2.6-x86-mingw32\/lib\/active_record\/c onnection_adapters\/mysql2_adapter.rb:14:in `new&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/mysql2-0.2.6-x86-mingw32\/lib\/active_record\/c onnection_adapters\/mysql2_adapter.rb:14:in `mysql2_connection&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/activerecord-3.0.1\/lib\/active_record\/connect ion_adapters\/abstract\/connection_pool.rb:230:in `new_connection&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/activerecord-3.0.1\/lib\/active_record\/connect ion_adapters\/abstract\/connection_pool.rb:238:in `checkout_new_connection&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/activerecord-3.0.1\/lib\/active_record\/connect ion_adapters\/abstract\/connection_pool.rb:194:in `block (2 levels) in checkout&#8217; C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/activerecord-3.<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:10:23. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Drew ruby-on-rails ruby ruby-on-rails-3 rubygems mysql2 Why would this method (list_id) be undefined when I have the adapter installed?== XXXXX: migrating ========================================&#8211; create_table(:XXXX)&#8211; list_id()rake aborted!An error has occurred, all later migrations canceled:undefined method `list_id&#8217; for #\/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:385:in `block in method_missing&#8217;HERE&#8217;S THE FULL LOAD:undefined method `list_id&#8217; for # \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:385:in `block in method_missing&#8217; \/Users\/dcarpenter\/Dropbox\/workspace\/gems\/activerecord-3.0.9\/lib\/active_record\/migration.rb:361:in `block in say_with_time&#8217; \/Users\/dcarpenter\/.rvm\/rubies\/ruby-1.9.2-p290\/lib\/ruby\/1.9.1\/benchmark.rb:295:in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-980","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=980"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/980\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}