Tag Archives: mysql

Case Study: Improving Performance of MySQL, Thinking Sphinx in a Rails app

Recently, we faced a huge performance problem with one of our installed apps. The application is a Call Center ERP solution. The Call model is updated very frequently as there are about approximately 8,000 – 10,000 calls being made everyday. … Continue reading

Posted in Case Studies, Ruby on Rails, Search | Tagged , , , , | Leave a comment

Getting started with MySQL on Amazon Web Services

> Getting started with MySQL on Amazon Web Serviceshttp://static.slidesharecdn.com/swf/ssplayer2.swf?doc=usingamazonwebservices-090422111735-phpapp01&stripped_title=getting-started-with-mysql-in-amazon-web-services&userName=ronaldbradford View more presentations from Ronald Bradford.

Posted in Ruby | Tagged , | Leave a comment

Copy database to another database through command

1. Copy One database to other on same host mysqldump -uroot -p source_database_name | mysql -uroot dest_database_name 2. Copy database from one host to other host. mysqldump -uroot -p source_database | ssh host2 “mysql -uroot dest_database”

Posted in General | Tagged | Leave a comment

Mysql cheatsheet

Change Mysql password mysqladmin -u root -p’oldpassword’ password newpass

Posted in General | Tagged | Leave a comment

Manual active record db connection in ruby using mysql adapter

Here is the code to make manual connection with database require ‘active_record’ActiveRecord::Base.establish_connection( :adapter => “mysql”, :host => “localhost”, :username => “root”, :password => “abcd”, :database => “funonrails” ) Load database configurations from yml file dbconfig = YAML::load(File.open(‘database.yml’))ActiveRecord::Base.establish_connection( dbconfig )

Posted in Ruby on Rails | Tagged , | 2 Comments

How to map irregular database tables with rails models

Rails specifies standard conventions while creating models, controllers, migrations ( database tables ). Conventions for creating database tables 1. Table name should be plural 2. id field must be primary_key for table. 3. foreign_key  must be like <model_name>_id i.e. post_id, … Continue reading

Posted in Ruby on Rails | Tagged , , | 2 Comments