Tuesday, September 30, 2008

Configuration of phpMyAdmin on ubuntu..

Configuration of phpMyAdmin on ubuntu..
As you know that phpMyAdmin is a database management and adminstration tool. So below is given the installation process of phpMyadmin. Let assume that you have already installed LAMP on ur system.
And incase if you have not installed LAMP then follow the following steps.
1. Open the terminal.
2. install apache [sudo apt-get install apache2].
3. install php [sudo apt-get install php5 libapache2-mod-php5]
4. Once it is installed restart the apache [sudo /etc/init.d/apache2 restart]
5. Install MySQL server [sudo apt-get install mysql-server] and set a password to local system to gets root access.
6. Install MySQL admin [sudo apt-get install mysql-admin]
7. Install MySQL for Apache HTTP Server [sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin]
8. Edit your php.ini file to work your php with MySQL [pico /etc/php5/apache2/php.ini] and add following line [extension=mysql.so]
9. Again restart you apache same command used in point 4.
Now once your LAMP installed all you need to edit your apache2.conf file which is located in '/etc/apache2/apache2.conf' and add the following like
[Include /etc/phpmyadmin/apache.conf] and then restart your apache as given in point 4.
That it and your phpmyadmin is configured.

For accessing you can use the following URL "http://localhost/phpmyadmin/" and if it is configured on server or some other system just changed localhost from domain name.

Your comments are welcome.

How to install RMagick Gem on Ubuntu?

To install RMagick with image magick on ubuntu is very simple you just need to run three commands from your terminal. Just make sure that you have install ruby and rubygem.

Once your ruby and rubygem is install run the following command.
1. sudo apt-get install imagemagick
2. sudo apt-get install libmagick9-dev
3. sudo gem install rmagick

Thats it and Rmagick in installed on your ubuntu environment.

Monday, September 29, 2008

uninitialized constant Gem::GemRunner (NameError)

/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

After installing ruby and rubygem on Ubuntu i started getting 'uninitialized constant Gem::GemRunner (NameError)' Error, so the solution for this is.
add the following command in your /usr/bin/gem
require 'rubygems/gem_runner'

Thats it and it will start working..

Wednesday, September 3, 2008

add_column new feature :after

Have created a new method, at the time of adding a new column in existing method. The method name is called :after
for ex
add_column :users, :user_info, :string, :after => "email"
when we execute the migration the email will be place just after user_info field in users table.

Monday, September 1, 2008

list of same column name from all the tables.

Hello Friend,
This time i'll tell you something about how we can know which table contains the same column name in a database.

[Note] This query only work in MySQL 5.02 and above

[Important]: - This query can help Ruby developer when they assigned a new project and if the project does not have a E-R diagram, As we never set a foreign key at a database level.
So here is the query

SELECT TABLE_NAME, COLUMN_NAME FROM information_schema.columns
WHERE COLUMN_NAME = user_id' AND table_schema = "test_development"

MySQL Database Dump from shell....

Hello Friends,
This is how we can take a database dump from command prompt.

1. Suppose you want to dump the entire database u can fire following command from cmd prompt...
"test_dump" will be your database name...
Your_location_where_you_want_to_save:\> mysqldump -u root -p test_dump > filename.sql


2. Suppose there are n numbers of table and we want to take a back of only 2 table let say table_abc, table_xyz from the "test_dump" database, so you can fire the below mention query...

Your_location_where_you_want_to_save:\> mysqldump --add-drop-table -u root -p test_dump table_abc table_xyz > filename.sql

Note: -
1. The filename can be anything.
2. Your_location_where_you_want_to_save = can be let say c drive c:\>