mysql2

mysql2 failing bundle install

吃可爱长大的小学妹 提交于 2019-12-06 19:20:32
I've been hung up on this issue for hours now and nothing I have found previously posted about this issue seems to work. Below is the mysql2 output for when I run bundle install : Fetching mysql2 0.4.5 Installing mysql2 0.4.5 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/MYUSERNAME/Desktop/MY_PROJECT/vendor/ruby/2.4.0/gems/mysql2-0.4.5/ext/mysql2 /Users/MYUSERNAME/.rbenv/versions/2.4.2/bin/ruby -r ./siteconf20180623-40170-ndn6t0.rb extconf.rb --with-mysql-config=/usr/local/Cellar/mysql/8.0.11/bin/mysql_config checking for rb

Facing error installing mysql2 gem

坚强是说给别人听的谎言 提交于 2019-12-06 13:35:29
Rails ask me to succeed with gem install mysql2 and on trying I got the following error.So what is mostly problem with such error? Detail of error is below: Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby --with

Error installing mysql2 gem on Ubuntu 16.04LTS

百般思念 提交于 2019-12-06 12:23:18
问题 I tried sudo gem install mysql2 -v '0.4.4' and got error. Checking /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/mkmf.log: "gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic

Rails 5 and Ruby 2.3.3 Failed to load libmysql.dll

无人久伴 提交于 2019-12-06 05:17:36
Getting below error message logged in the console while starting the server for an application created with mysql database. Failed to load libmysql.dll from C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\mysql2-0.4.7-x86-mingw32\vendor\libmysql.dll Environment Details : Window 7 64 bit Rails 5.0.4 ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32] mysqld Ver 5.7.18 for Win64 on x86_64 (MySQL Community Server (GPL)) Post install message from mysql2 ruby gem received below message on the console. You've installed the binary version of mysql2. It was built using MySQL Connector/C

Mysql2: close client connection

倖福魔咒の 提交于 2019-12-06 02:40:47
问题 I am using Mysql2 to query a database on ruby . I initialize the connection by: client = Mysql2::Client.new(:host => "localhost", :database => 'mydb', :username => "root") Once the query is done successfully, how can I close the client connection? If I do not close it, I soon reach the maximum number of possible open connections. Solution Thanks to @joonty: client.close 回答1: Use client.close . From the docs: Mysql2::Client#close Immediately disconnect from the server, normally the garbage

Using prepared statement with MySQL2 gem?

久未见 提交于 2019-12-05 19:22:36
How do I create prepared statements for insert and select queries in MySQL? I am using the MySQL2 gem, and my connection object looks like this: con = Mysql2::Client.new(:host => "#{ENV['DB_HOST']}", :port => '3306', :username => "#{ENV['DB_UNAME']}", :password => "#{ENV['DB_PWD']}", :database => 'dbname') Unfortunately, mysql2 gem does not have prepared statement support yet. The contributors are planning to add such a feature in a near future, as we can see by this Pull Request discussion: https://github.com/brianmario/mysql2/pull/289 If you must have prepared statements in your application,

Ruby mysql2 multiple statements in single query

一笑奈何 提交于 2019-12-05 19:04:46
I have an issue where I'm updating millions of rows in my DB, so rather than updating each one individually I want to join groups of ~1000 statements into a single query. I have enabled MULTI_STATEMENTS like so client = Mysql2::Client.new(:host => 'localhost', :database => 'mehdb', :username => "root", :password => "", :flags => Mysql2::Client::MULTI_STATEMENTS) Here's an example of the code I'm running sql = "SELECT id, x FROM pew WHERE x IS NULL LIMIT 1000" results = db_read.query(sql) while results.count > 0 updates = '' results.each do |r| updates += "UPDATE pew SET x = 10 WHERE id = #{r[

Error installing Mysql2 gem- 10.6 Server

不羁的心 提交于 2019-12-05 17:53:41
I'm trying to install the mysql2 gem on 10.6 server and I get an error message I haven't seen: EBuilding native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for rb_thread_blocking_region()... no checking for mysql.h... no checking for mysql/mysql.h... no ----- mysql.h is missing. please check your installation of mysql and try again. ----- *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary

-Fatal- failed to allocate memory - Rails 3.1 and Mysql2 Gem

与世无争的帅哥 提交于 2019-12-05 09:36:23
I'm having a strange problem with the latest 'mysql2' gem and Rails 3.1 I can run mysql fine from the IRB when I include the gem, but with rails whenever I attempt to save to the database in the console, or even load up the page when the server starts, i get [FATAL] Failure to Allocate Memory . There don't seem to be any mysql logs available, and that is the only error Rails shows. Interestingly enough, when I do start a connection in the Rails console and just run a count query e.g. User.count, it works fine, but when I try to exit the console it hangs indefinitely . All the guy I'm pairing

Error installing mysql2 gem on Debian Squeeze

爷,独闯天下 提交于 2019-12-05 04:34:11
I got this "popular" error while installing mysql2 gem on Debian Squeeze: gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... no checking for mysql.h... yes checking for errmsg.h... yes checking for mysqld_error.h... yes creating Makefile make gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9