How To Reset WordPress Password via MySQL Command

I decided to write this article because recently I was totally locked out of my blog because I forgot my username and password and unfortunately for some reason the reset password via email is not functioning.. LOL

My last option was to reset it via SSH and do some MySQL FU. ūüôā

Okay here we go with the few steps to reset our password.

1 .  Login to your server via SSH.

2 . Login to MySQL

3.  Once you are in you will need to select the correct database. Look for the name that you found in your wp-config.php.

Command to show list of database:

4.  Select the correct database and DB table. Let say our database name is freedomSMS.

Selecting database:

Showing available tables in DB freedomSMS:

5. We are looking for the users table to reset our password. If you didn't change the table prefix during installation then the default would be wp_users table.

To show all users in wp_users table:

6.  The above command will show the users in your wordpress blog and other details like login password.  You will notice that there are many random characters stored in the password field of the user. Due to security reasons, WordPress stores the passwords as MD5 Hash rather than Plain text.

This means that you will not be able to enter plain text as the password. If I would like 'iloveyou'  to be my new password then the equivalent MD5 hash for that is 'f25a2fc72690b780b2a14e140ef6a9e0' .. Use this website to generate MD5 hash.

7. Updating user password.  For Example we will update or change the password of user Mboy.

Enjoy! You can now login to your wordpress site using Mboy as username and iloveyou as your password..! ūüôā


Monitoring Postfix Queue


This is a very basic postfix queue monitoring script to alert the administrator if the queue is filling up for some reasons.

Understanding the script

We are using the mailq command to see how many messages are about to be sent. The output of mailq should look like this.


$ mailq

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------

24A12120A80* 479 Tue Apr 29 13:29:16

2669E120A65* 479 Tue Apr 29 13:29:16

28E74120844* 479 Tue Apr 29 13:29:16

-- 2 Kbytes in 3 Requests.

Just see the last line of the output '-- 2 Kbytes in 3 Requests.' 3 request is the key so that we will know how many messages are pending in the queue.

You can extract the the number of requests with the following command:

/usr/bin/mailq | /usr/bin/tail -n1 | /usr/bin/awk '{print }'

Do some queue count validation of your choice before alerting and adjust the limit variable as necessary.

Check the code in github - PostfixQueueMonitoring


Installing SNMP in CentOS

1. Install SNMP.

 yum  install net-snmp net-snmp-utils 

2. Create a new user using the net-snmp-create-v3-user command.

 net-snmp-create-v3-user -ro -A  auth_password  -X  privacy_password  -a SHA -x AES user_name

3. Test it with

snmpwalk -v 3 -u user_name -a SHA -A  auth_password  -l authPriv -x AES -X privacy_password  localhost

4. Configure your monitoring tool with the above details.
5. Start SNMP

 /etc/init.d/snmpd start


How To Add Swap on Ubuntu

About Linux Swapping

Linux RAM is composed of chunks of memory called pages. To free up pages of RAM, a ‚Äúlinux swap‚ÄĚ can occur and a page of memory is copied from the RAM to preconfigured space on the hard disk. Linux swaps allow a system to harness more memory than was originally physically available.

However, swapping does have disadvantages. Because hard disks have a much slower memory than RAM, virtual private server performance may slow down considerably. Additionally, swap thrashing can begin to take place if the system gets swamped from too many files being swapped in and out.

Check for Swap Space

Before we proceed to set up a swap file, we need to check if any swap files have been enabled on the VPS by looking at the summary of swap usage.

An empty list will confirm that you have no swap files enabled:

Check the File System

After we know that we do not have a swap file enabled on the virtual server, we can check how much space we have on the server with the df command. The swap file will take 512MB‚ÄĒ since we are only using up about 8% of the /dev/sda, we can proceed.



Create and Enable the Swap File

Now it’s time to create the swap file itself using the dd command :


‚Äúof=/swapfile‚ÄĚ ¬†designates the file‚Äôs name. In this case the name is swapfile.
Subsequently we are going to prepare the swap file by creating a linux swap area:

The results display:


Finish up by activating the swap file:

You will then be able to see the new swap file when you view the swap summary.


This file will last on the virtual private server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file.

Open up the file:

Paste in the following line:

Swappiness in the file should be set to 10. Skipping this step may cause both poor performance, whereas setting it to 10 will cause swap to act as an emergency buffer, preventing out-of-memory crashes.

You can do this with the following commands:

To prevent the file from being world-readable, you should set up the correct permissions on the swap file:

Reboot for the change to take effect.You can also change the value while your system is still running


you can also clear your swap by running swapoff -a and then swapon -a as root instead of rebooting to achieve the same effect.


To calculate your swap Formula


so what it mean is that when 10 % 395 MB of ram left then it start using swapiness.


Sources: and

df falsely showing 100 percent disk usage

df falsely says filesystem usage at 100%, and so do other applications whilst du / -sh shows an expected value.

Both are correct. The difference is that whenever an application has an open file, but the file is already deleted, then it is counted in the df output (because the space is certainly not free) but not in du (because it is not being used by a file).

Just do a 'lsof | grep deleted' and I'm almost certain you'll see some large file in /var/log being held open by some daemon that wasn't restarted whenever it's logfile was rotated. Just restart that daemon (and don't forget to fix the logrotate scripts for that daemon and/or file a bugreport about it)

My first guess is you have deleted some files that are still open. DU will not show the deleted files, but since they are still in use DF will count them.


Sure enough this was the case. I restarted zenoss stack and the server returned itself to normal.


Originally posted by Andrew Dodson @

Monit – State file ‘/var/lib/monit/state’: Unable to read magic

The magic is used to differentiate old state file format (which started with number of services) from the new extensible state file format (starts with 0, which is the "magic" - older monit versions will always start with number > 0).

It seems that the user's statefile is probably empty, hence the error is returned.

The solution is simple:

1.) stop monit
2.) remove the state file: rm -f /var/lib/monit/state
3.) start monit (will create new state file)

Originally posted by Martin @