Sunday, November 21, 2010

Impotant Port Numbers

To configure network services/servers, administrator must have a Knowledge of  Port numbers,. So you can  easily find out whether service/daemon is running or not. It will be very helpful when you are configuring iptables/firewall. Ex: You can block unwanted port numbers, it will reduce the risk of hack to the servers.
Here i am listing very common ports which we will use in everyday tasks.


Services                             Portnumber
FTP                                      20 and 21
SSH                                     22
TELNET                               23
SMTP                                  25
DNS                                    53
DHCP                                  67 and 68
TFTP                                   69
HTTP                                   80
NTP                                    123
POP3                                  110
IMAP                                  143
HTTPS                                443
IMAPS                                993
POP3S                                995
SWAT                                 901
SQUID                                3128
MYSQL                              3306
X-WINDOW                        6000
WEBMIN                           10000

Tuesday, November 9, 2010

Backup and Restore Mysql database

It is very important to backup databases to prevent any  loss of data. The easiest way backup the database is Mysqldump and we can restore it with mysql command...

Backup Syntax:
 #mysqldump -u [username] -p [databasename]  > dumpfilename.sql

Ex: you assume that you want to backup a database called users and with username root, then the command would be....
#mysqldump -u root -p users > users.sql
In the above example "-p" will prompt for password, and  if your mysql doesnot have any password then no need to use "-p".

Restore Syntax:
Mysqldump file can easily be restored by using the following command
#mysql -u root -p [databasename] < [mysqldumpfile.sql]

EX: #mysql -u root -p users < users.sql