Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Saturday, January 15, 2011

Tuesday, February 16, 2010

Copy database to another database through command

by sandipransing 0 comments
1. Copy One database to another database on same host
mysqldump -uroot -p | mysql -uroot 2. Copy database to another database on remote host
mysqldump -uroot -p | ssh host2 "mysql -uroot "
Read More…

Thursday, February 4, 2010

Mysql cheatsheet

by sandipransing 0 comments
Change Mysql password


 mysqladmin -u root -p'oldpassword' password newpass
Read More…

Thursday, November 12, 2009

Manual active record db connection in ruby using mysql adapter

by sandipransing 2 comments
Below is ruby code to establish manual database connection.
require 'active_record' ActiveRecord::Base.establish_connection( :adapter => "mysql", :host => "localhost", :username => "root", :password => "abcd", :database => "funonrails" )
Snippet of database.yml file
common: &common adapter: mysql database: students_dev username: root password: host: localhost students_development: <<: *common database: students_dev students_production: <<: *common database: students
Load database configurations from yml file
dbconfig = YAML::load(File.open('database.yml')) ActiveRecord::Base.establish_connection( dbconfig[:students_development] )
Active Record Model & DB connection
class Student < ActiveRecord::Base establish_connection "students_production" set_table_name "student" set_primary_key "stud_number" end
Read More…

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter