Show all records containing the name "Telson" AND the phone number '2255'.SELECT * FROM [table name] WHERE name = "Telson" AND phone_number = '2255';

Show all records not containing the name "Telson" AND the phone number '2255' order by the phone_number field.SELECT * FROM [table name] WHERE name != "Telson" AND phone_number = '2255' order by phone_number;

Show all records starting with the letters 'Tel' AND the phone number '2255'.SELECT * FROM [table name] WHERE name like "Tel%" AND phone_number = '2255';

Use a regular expression to find records. Use "REGEXP BINARY" to force case-sensitivity. This finds any record beginning with a.SELECT * FROM [table name] WHERE rec RLIKE "^a$";

Show unique records.SELECT DISTINCT [column name] FROM [table name];

Show selected records sorted in an ascending (asc) or descending (desc).SELECT [column1],[column2] FROM [table name] ORDER BY [column2] DESC;

Return number of rows.SELECT COUNT(*) FROM [table name];

Sum column.SELECT SUM(*) FROM [table name];

Join tables on common columns.select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;Creating Mysql databse Users and changing Password

Switch to the mysql db.

Create a new user.INSERT INTO [table name] (Host,User,Password) VALUES('%','user',PASSWORD('password'));

there can be lot of frozen messages in the queue which are not delivered most probabalt spammed messages the script deletes themexim -bp | awk '$6~"frozen" {print $3 }' | xargs exim -MrmRemove all messages older than five days (86400 * 2 = 172800 seconds).

The number of mails by a domainexigrep @domain.com /var/log/exim_mainlog|grep 2009-04-17|grep Completed|wc -l

1)Issue this command: ps -C exim -fH ewww |grep home, it shows the mails going from the server.It shows from which user’s home the mail is going, so that you can easily trace it and block it if needed.

3)Issue this command: exim -bp | exiqsummIt shows the main domains receiving and sending mails on the server.

4)Issue this command: netstat -plan|grep :25|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1It shows the IPs which are connected to server through port number 25. It one particular Ip is using more than 10 connection you can block it in the server firewall.

It will give some result like:Example :6 PWD=/347 PWD=/home/sample/public_html/testCount the PWD and if it is a large value check the files in the directory listed in PWD(Ignore if it is / or /var/spool/mail /var/spool/exim)

The above command is valid only if the spamming is currently in progress. If the spamming has happened some hours before, use the following command.