ERROR! MySQL server PID file could not be found!

Dec03

If you are getting below Error message:-
ERROR! MySQL server PID file could not be found!
Starting MySQL… ERROR! The server quit without updating PID file (/var/lib/mysql/xxxx.com.pid).

Login to the server as a root user with SSH

Create the directory as /var/run/mysql

[root@office1 ~]# mkdir /var/run/mysql

Now create  file mysqld.pid

[root@office1 ~]#touch mysqld.pid

and change its ownership to  mysql:mysql

[root@office1 ~]#chown mysql:mysql mysqld.pid

Now try to Restart MySQL service and its restarted successfull 😀 ?

How you can check/preview your website before switching DNS?

Dec03

You can Locate the HOSTS file on your computer. Depending on the operating system you have, the following are locations you may be able to find this file.

Windows NT/2000/XP/2003/Vista:

c:\windows\system32\drivers\etc\hosts

Windows 95/98/Me:

c:\windows\hosts

Open the above  file with any text editor such as notepad or wordpad.
You will see two columns of information, the first containing IP addresses and the second containing host names.

By default it is look like as below  entry.

127.0.0.1 localhost

You will need to add lines just underneath to the  existing line.

Suppose the IP address of your new server is “98.25.64.33” and the domain you want to preview/check  is “www.alam.co.in”:

You will need to add the lines just underneath the existing line that will point requests from
your computer to your new server’s IP address.

98.25.64.33 alam.co.in
98.25.64.33 www.alam.co.in

Now just save the file and chek/preview your site in any browser as follows

http://alam.co.in or http://alam.co.in  to test your new server.

Note: When you are finished testing your new server please don’t forget to revert the changes i.e to remove the lines you added above.

How to Blocked External Service Update request from WordPress

Aug19

As we know by default, WordPress  allows us to update services, where all the  services will notified the external link on the update of your blog.

However, if you do not want to update these update services anymore you just add the below code in your  wp-config.php file of your WordPress.

define('WP_HTTP_BLOCK_EXTERNAL', true);

How to find your friends WordPress Theme

Aug19

Do you every have a question in your mind , which WordPress theme is that ? or which WordPress theme your friend  is using ?

Ans :-

You just find it to click here and  you may easily track the WordPress theme used by that site.

 

Enjoy 😀

WordPress Visual Editor not working

Aug19

While after updating or installing WordPress you found that your Visual editor is missing or not working,

when you want to add a new article.

Sol :->

To resolved  this issue, simply add  the below code at the bottom of the line in your  wp-config.php file of your WordPress.

define( ‘CONCATENATE_SCRIPTS’, false ); 

How to get WordPress version from backend

Aug18

Login to the directory where WordPress is installed  Like as below and grep it :

root@server [~]# cd /home/user/public_html
root@server [/home/user/public_html]# grep wp_version wp-includes/version.php
* @global string $wp_version
$wp_version = ’2.8.6′;

MYSQL command to manage WordPress Database

Aug12

Below is very usefull commands of WordPress using MYSQL shell :-
1) first login as a Root and access your database using your database login

root@data[~]# mysql -u DB_USER -p
Enter password:

2) Use your Database 
mysql> use DB_NAME;

3)To check the current theme in wordpress :-
mysql> SELECT * FROM `wp_options` WHERE `option_name` = ‘current_theme’;

4)To check the siteurl link :-
mysql> select * from wp_options where option_name = ‘siteurl’;

5)To check the home URL link :-
   mysql> select * from wp_options where option_name = ‘home’;

6)To change the “siteurl” and “home” URL :-
mysql>  UPDATE wp_options SET option_value = replace(option_value, ‘http://current url ‘, ‘http://New URL’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

7)To check how many users in wordpress :-
   mysql> select * from wp_users where user_login like ‘%’;

8)To change the user-password :-
mysql>  UPDATE `wp_users` SET `user_pass` = MD5( ‘12345678’ ) WHERE `wp_users`.`ID` =1;     —–> ID represent diffrent users.

9)Show all tables in the database:-
   mysql> show tables;
+—————————+
| Tables_in_DB_NAME |
+—————————+
| wp_commentmeta            |
| wp_comments               |
| wp_links                  |
| wp_options                |
| wp_postmeta               |
| wp_posts                  |
| wp_term_relationships     |
| wp_term_taxonomy          |
| wp_terms                  |
| wp_usermeta               |
| wp_users                  |
+—————————+
11 rows in set (0.00 sec)

11) Description about the tabel :-
mysql> describe wp_users;

Enjoy in easy way 😀

 

Replace Command

Jul28

Find and replace string using VI editor

Open file in VI
vi filename
esc
:%s/old string/new String/

How to replace a string using sed command.

cd /folder/

sed -i ‘s/string_to_be_replaced/new string/g’ *               —> Without SPACES in between.

cd /var/named/

sed -i ‘s/86400/300/g’ *.db

ssh_exchange_identification: Connection closed by remote host

Jul25

Check if the host file has any conflicting entries.

[root@support ~]#cat /etc/hosts.deny

[root@support ~]#cat /etc/hosts.allow

eMail Spamming Troubleshoot

Jul25

Some scripts that are used to send out spam emails :

[root@support ~]#grep “cwd=” /var/log/exim_mainlog|awk ‘{for(i=1;i<=10;i++){print $i}}’|sort|uniq -c|grep cwd|sort -n

Eximstats
[root@support ~]#eximstats -t5 /var/log/exim_mainlog > teststats

Script to know the mail count by various accounts
[root@support ~]#grep “cwd=” /var/log/exim_mainlog|awk ‘{for(i=1;i<=10;i++){print $i}}’|sort|uniq -c|grep cwd|sort -n

The number of mails by a domain
[root@support ~]#exigrep @domain.com /var/log/exim_mainlog|grep 2009-04-17|grep Completed|wc -l

[root@support ~]#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.

[root@support ~]#eximstats -ne -nr /var/log/exim_mainlog
It shows top 50 domains using mail server with options.

[root@support ~]#exim -bp | exiqsumm
It shows the main domains receiving and sending mails on the server.

[root@support ~]# netstat -plan|grep :25|awk {‘print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1
It 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.

In order to find “nobody” spamming, issue the following command
[root@support ~]#ps -C exim -fH ewww|awk ‘{for(i=1;i<=40;i++){print $i}}’|sort|uniq -c|grep PWD|sort -n
It will give as like below result :-
Example :
6 PWD=/
347 PWD=/home/sample/public_html/test
Count 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.

Command :
[root@support ~]#grep “cwd=” /var/log/exim_mainlog|awk ‘{for(i=1;i<=10;i++){print $i}}’|sort|uniq -c|grep cwd|sort -n
This will result in something like :
96 cwd=/root
4583 cwd=/home/sample/public_html/test

Count the cwd and if it is a large value check the files in the directory listed in cwd
(Ignore if it is / or /var/spool/mail /var/spool/exim)

Pass the below mentioned command at your command prompt to find the domain which is being used by spammers.

[root@support ~]#exim -bpr | exiqsumm -c | head
[root@support ~]#exiqgrep -ir <domain> | xargs -n1 exim -Mrm

That should remove any e-mail that is in the queue that is waiting to be delivered to POP accounts at <domain>.

Take below Precautions:
I)Turn on the SMTP tweak. It will block the users to bypass the mail server for sending out spam.
II)Turn on blacklisting ability in whm.
III)Use spamassassin to stop receiving spam mails.

Sidebar