Questions tagged [mysql2]

The Mysql2 gem is meant to serve the extremely common use-case of connecting, querying and iterating on results.

The mysql2 gem is an interface for accessing MySQL databases from Ruby. This gem is an incompatible improvement over the original mysql gem.

Links:

907 questions
0
votes
1 answer

Where can I get the nsslowhash lib from for fedora 16? Source preferably

While 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 "ruby.h" /*top*/ int main() {return 0;} int t() { void ((*volatile…
Eric
  • 2,115
  • 2
  • 20
  • 29
0
votes
1 answer

Ruby Mysql2: different results using count method

I'm using .count method in a mysql2 query results: My code: require "mysql2" hostname='db.xxxxx.xxx' port='3306' username='xxxxxx' password='xxxxxxxxxxxxxxxxxxxxxxxxxx' database='xxx' dbh = Mysql2::Client.new(:host=> hostname,…
-1
votes
1 answer

uri format connection gets access-denied in mysql

I'm using Node and MySQL2 import mysql2 from 'mysql2' Following successfully creates connection: const connection = mysql2.createConnection({ host: 'localhost', user: 'root', password: 'My@Password', database:…
helloworld
  • 2,179
  • 3
  • 24
  • 39
-1
votes
1 answer

How to change docker compose for Rails and MySql2?

I have an ancient (like 2012) Ruby on Rails server that uses MySql2 database. The server, of course, is not made by me so I now have to find out how even launch it. And I want to use Docker for that. I found this guide to setup Docker container for…
-1
votes
1 answer

Trying to pass variables into a prepared statement in JavaScript Node JS

function addEmployee() { inquirer .prompt([ { name: "firstname", type: "input", message: "Enter their first name ", }, { name: "lastname", type: "input", message: "Enter their…
-1
votes
1 answer

How to workaround 'library not found' errors when installing mysql2 in Mac

I'm trying to install mysql2 in my Mac running on MacOS Big Sur. When I run 'gem install mysql2' I get: library not found for -lzstd If I then run 'gem install mysql2 -- --with-opt-dir="$(brew --prefix zstd)"' I get: library not found for -lssl I…
-1
votes
1 answer

Updating storaged info but Im getting error every time I try to update it

so my problem is that I'm getting one very annoying error when I try to remove a warning and update it in my database. I do not know what is wrong but if I wrote everything correctly then it should normally work but it gives an error... I want it…
-1
votes
1 answer

Problem with asynchronous request to the database

I have a "Place your order" button that calls /orderRegistration, which in turn updates the quantity of product in stock according to the order and sends the confirmed order to the email const orderStatus = ['Confirmed', 'Not…
-1
votes
2 answers

MYSQL Query within Rails

Need to update a field within my mysql db. Would like to use the following query within rails: update users set exported = TRUE where id = #{name[12]} Currently, have the following: db = Mysql2::Client.new( :host => 'localhost', :username =>…
Atsu Mori
  • 11
  • 5
-1
votes
2 answers

How to connect from MySQL to Ruby on rails using database.yml file properly?

I have a problem with the connection between MySQL and Ruby on rails. I have a database in MySQL, and I need to migrate it to ActiveRecord in Ruby on rails. To do that, I have to change the database.yml file in my ruby on rails project, like this:…
Alvaro
  • 11
  • 3
-1
votes
1 answer

Mysql2::Error at / Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I am trying to connect to a mysql server running on a Fedora machine listening on port 3306 at the socket /var/lib/mysql/mysql.sock The mysql client is an ROR application which has been launched on a ubuntu machine using vagrant. From within the…
sams
  • 1
  • 3
-1
votes
1 answer

ruby: mysql2 select statement with null

I try to select all rows with ruby where the field is null. Either I get zero results or the statement is invalid. So far I tried: db.query("SELECT * FROM names where name is null;") db.query("SELECT * FROM names where name is…
user2211703
  • 489
  • 2
  • 5
  • 14
-1
votes
1 answer

ruby on rails model creation error

i am new to ruby. When i am creating the model it gives the following error. Please resolve this issue. noexec.rb:75:in `block in setup': undefined method `name' for ["hike-1.2.3", #]:Array…
Rajesh M
  • 1
  • 5
-1
votes
1 answer

Webrick Rails Server doesn't run correctly

I have spent the last 6 hours fixing issues like modifying the $PATH, installing Gems to finally get everything as it should be. but after I create the project folder with it's components and trying to run the server, I got this message :- \KAMAL$…
-2
votes
2 answers

MySQL mysteriously adding VALUES

I have this code in my project app.post('/history/form/confirm', isLoggedIn, (req,res)=>{ let code = req.body.pcode, quanti = req.body.qty, price = req.body.price, cust = req.body.orderedBy, oDate =…
1 2 3
60
61