Fun at work!

Archive for July, 2013

How to display line numbers in Eclipse IDE?

By default, Eclipse’s editor does not display line numbers. Follow this simple guide to enable “Show line numbers”:

In Eclipse IDE, go to Window>Preference>General>Editors>Text Editors, and check Show line numbers. See screenshot below.

Eclipse Display Line Number

How to delete spam comments on WordPress?

I am self-hosting a WordPress blog site (not this one). And though I did not allow “Comments”, my site received hundred and thousands of spam comments. To delete these unapproved comments all at once, I directly access my database and issue the command:

mysql> DELETE FROM wp_comments WHERE comment_approved = '0';

Note: I have not installed a plugin for spam protection like Akismet.


			

How to reset MySQL root password?

It is easy to forget the root password as it is advised to use the user account for security reason. Today, I needed to access my MySQL database as root, but I could not remember the password. After searching for a solution, I found this method to be awesome:

1. Run the server with –skip-grant-tables option so that you can log in without a password.

# /etc/init.d/mysqld stop
# mysqld_safe --skip-grant-tables &
$ mysql -u root

2. Reset the root password.

mysql> use mysql;
mysql> update user set password=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where user='root';
mysql> flush privileges;
mysql> quit

3. Restart MySQL and log in using your new root password.

# /etc/init.d/mysqld stop
# /etc/init.d/mysqld start
# mysql -u root -p
 

Tag Cloud