mysql2

Problem with rake db:migrate -

强颜欢笑 提交于 2019-12-22 16:44:49
问题 I am unable to setup my MySQL DB for Ruby on Rails. After setting up the DB and making sure the config/database.yml file match, I am running into the error message below. U:\Rails\alpha>rake db:migrate --trace (in U:/Rails/alpha) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! Access denied for user 'admin'@'207-237-91-100.c3-0.avec-ubr13.nyr-avec.n y.cable.rcn.com' (using password: YES) C:/Ruby187/lib/ruby/gems/1

Facing error installing mysql2 gem

我们两清 提交于 2019-12-22 12:19:53
问题 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

Using prepared statement with MySQL2 gem?

走远了吗. 提交于 2019-12-22 10:34:59
问题 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') 回答1: 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

Ruby mysql2 multiple statements in single query

隐身守侯 提交于 2019-12-22 09:08:04
问题 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)

LOAD DATA LOCAL INFILE causes Malformed packet error with mysql2 gem

﹥>﹥吖頭↗ 提交于 2019-12-22 07:00:07
问题 I'm trying to issue a LOAD DATA LOCAL INFILE query to load some CSV data into a table using the mysql2 gem (0.3.11) under rails 3.1.1: class Foo < ActiveRecord::Base def self.load_csv query = "LOAD DATA LOCAL INFILE 'test/foo.csv' REPLACE INTO TABLE foos LINES TERMINATED BY '\n' (title)" ActiveRecord::Base.connection.execute(query) end end (This is a sample app to reproduce the error for this github issue). This keeps failing on OS X (Lion) with the following error: Mysql2::Error: Malformed

Mysql2 gem not working with UTF8

两盒软妹~` 提交于 2019-12-22 00:25:17
问题 I've switched my Rails app from the Mysql gem to Mysql2, but now UTF8 fields aren't working; specifically, the character á is coming out as á. The character appears correctly in the MySQL console, when using PHP, and when using the Mysql gem. I have set encoding: utf8 in my database.yml file. Potentially helpful When I inspect it character-for-character in the console, I see that á is "\303\241" (using the Mysql gem) but á is "\303\203\302\241" (using the Mysql2 gem). 来源: https:/

Installing mysql2 gem on Mac os x Lion

大兔子大兔子 提交于 2019-12-21 02:42:17
问题 The other day I updated to Mac OSX Lion. It broke my rails install as I had to re complie mysql. While I have got that working reinstalling the mysql2 gem has become problematic. I was perviously running leopard so I am going from 32 to 64 bit. ~/code/rails/london (master)$ gem install mysql2 -- --with-mysql-dir=/usr/local/mysql Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /Users/stewartmatheson/.rvm/rubies

Failure to install old mysql2 gem

痞子三分冷 提交于 2019-12-20 20:27:34
问题 I am using Mac High Sierra. I am using Ruby 2.2.1 with RVM. I need to use mysql2 with this Ruby on Rails app. I do have mysql 5.7 installed. I do have xcode installed along with the command-line tools. I am simply trying to get this company app working on my local machine. I know that I am very close but I have one final error when I do bundle install I receive the following error when I get to the mysql2 gem: Fetching mysql2 0.3.18 Installing mysql2 0.3.18 with native extensions Gem::Ext:

Use MariaDB instead of MySQL in my Rails project

a 夏天 提交于 2019-12-20 11:30:38
问题 How can I use MariaDB instead of MySQL in my Rails project? When I try to install mysql2 gem it returns error,because mysqlclient was not found. Here some solution, but I didn't found any libmariadbd-dev package on my openSUSE 12.3. 回答1: It doesn't look like openSUSE has a MariaDB client development package. You must install the libmysqlclient-devel package package. Since MariaDB is tagged as a drop in replacement for MySQL, it would have to support the MySQL clients, though you may lose tiny

Rails: Specified 'mysql2' for database adapter but the gem is not loaded

别来无恙 提交于 2019-12-20 06:15:43
问题 apparently there is a thread that addresses this issue . But I have already tried to run those commands given in the solution. I am still getting the same error for some reason. I run gem install mysql2 -v 0.3.18 followed by bundle install on my terminal. And than I start the server by typing rails server Upon opening the localhost:3000. I receive the same error. Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile (and ensure its version is at