LoginSignup
4
2

More than 3 years have passed since last update.

Rubyでmysqlに接続する

Last updated at Posted at 2017-04-08

Rubyでmysqlにデータを読み書きする方法。
RubyでスクレイピングしたデータをDBに書き込みたいときなどに使えます。

require 'mysql2'

client = Mysql2::Client.new(host: 'localhost', username: 'root', password: '', database: 'db_name')
client.query("SQL文")
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2