Skip to content

Instantly share code, notes, and snippets.

@jmscholen
Last active July 28, 2016 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmscholen/e4995b061d305cddf023ad2b8a7c6747 to your computer and use it in GitHub Desktop.
Save jmscholen/e4995b061d305cddf023ad2b8a7c6747 to your computer and use it in GitHub Desktop.
Setting up MySQL dB connection within Ruby Script and Rails app
require 'yaml'
require 'mysql'
@dbconfig = YAML.load(File.read('/home/dev/app/config/database.yml'))
@con = Mysql.new(@dbconfig["#{env}"]['host'],
@dbconfig["#{env}"]['username'],
@dbconfig["#{env}"]['password'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment