Friday, June 20, 2008

database dump for mysql and postgreSQL

User's data is very very important. Obviously most of application stores user data in the database.

Database backup is mandatory those who are use user data in their application.

If something happen to database, using dump we can restore the backup to the database.

MySql database:
To dump/export:
mysqldump --user {username} --password {password} {database} backup.sql

mysqldump is the command to dump/export the database to file.

To undump/import:
mysql --user {username} --password {password} {database}
This will extract backup.sql to the database
PostgreSQL database:

To dump/export:
pg_dump -h {host-name} -U {username} -p {database name} backup.sql

pg_dump is the command to dump the database. The above command dump all data in the database {database} to the backup.sql file.

To undump/import:
psql -h {host-name} -U {username} -p {database name} < backup.sql
Dump/Export postgreSQL database:

Same as mysql this command will import data from backup.sql to the database.

Monday, June 9, 2008

compile lighttpd server from source

To install any server like 'lighttpd' for windows operating system we can download and install using .exe file.
Same way we could do it for other operating system [sun solaris, linux and mac]also. But for some specific distribution there won't be any executable version of software.

In this case, we can compile from source code and install the same.

I explained installation steps in the ubuntu[linux distribution] server.

Login as root.

There is two way to download the source code

1) Using terminal:
Copy the url of the software which we want to install. That might be any kind of compressed format. for ex:[tar.gz,tar.bz2,etc...] and use the following command
wget {URL}
this will downloads source code using terminal.
2) Using GUI
Click on download link and save to local file system.

Steps to compile and install:
i) Uncompress the file which one we downloaded. Using the following command in terminal
if downloaded file is .tar.gz format use tar -xzvf {downloaded file name}
if downloaded file is .tar.bz2 use tar -xjvf {downloaded file name}

ii) Get inside the folder and there is file named "configure" and type the following command
if we want install in any specific directory, mention directory using the following command.
./configure --prefix = {directory}.... [default installation directory is /opt/
The above command will configure the compilation environment.

iii) Type the following to compile
now source code compiled.

iv) To install
make install
Now server is installed and ready for you.