Sunday, December 25, 2011

Adding Users in Mysql and Granting Privileges

You can add users to this database and specify the databases to which they will have access with the grant command, which has the syntax.

sql> grant all privileges on database.* to username@"servername" identified by 'password';

Example:
sql> grant all privileges on data1.* to dbuser@"localhost" identified by 'secdat';

Where data1 is the database name
dbuser is the user name who has to access the db / name of new user.
secdat is the password

If you want to restrict that user from full privilege on a db you can use the following syntax:

sql> grant CREATE,INSERT,DELETE,UPDATE,SELECT on data1.* to dbuser2@localhost;

Thursday, December 22, 2011

Fix wampserver when the icon stays on orange

Below is the solution on how to fix wampserver when the icon stays on orange

1. Open Control Panel then Network Connections.
2. Right click on Local Area Connection and select Properties
3. Double click on the Internet Protocol (TCP/IP) line to open the Properties
4. On the General tab, click the Advanced button
5. Click the wins tab and uncheck the Enable LMHOSTS Lookup box

Wednesday, December 21, 2011

rsync with port number

 rsync is a software application and network protocol for Unix-like and Windows systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. rsync can copy or display directory contents and copy files, optionally using compression and recursion.
Trouble with rsync while transfering to a server with port number ??

Here is the correct syntax :
There are 2 ways to use this command.

1. If you are trying to transfer the files from remote server to your system then use the syntax below:

-----
rsync -avz -e "ssh -p $portNumber" user@remoteip:/path/to/files/ /local/path/
-----
2. If you are trying to transfer the files from your system to remote server then use the syntax below:
-----
rsync -avz /local/path/ -e "ssh -p $portNumber" user@remoteip:/path/to/files/
-----

Awstat not Updating in cPanel and Combined error Log

Yesterday I found a strange issue with awstat as it suddenly stopped reporting the data. I could get the past data but not able to get the current data. As usual as a part of debugging i opened the errorlogs and domlogs. I found something strange in the domlogs.  The word "combined" was repeating in the logs:

 # vi /usr/local/apache/domlogs/
combined
combined
combined
combined
combined
combined
combined
combined



After hours of searching and testing i found the solution. I am sharing it below:


Open the apache conf with your favorite editor.
#vi /usr/local/apache/conf/httpd.conf
Search for the line
--------
ErrorLog /usr/local/apache/logs/error_log
--------
Beneth that line add the following:
--------
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{Referer}i -> %U" referer
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{User-agent}i" agent
--------
Save and exit, then run:
--------
/usr/local/cpanel/bin/apache_conf_distiller --update
/usr/local/cpanel/bin/build_apache_conf
restart apache
/scripts/restartsrv_httpd
--------
Awstat started updating itself at last. :)

Sunday, December 18, 2011

Wordpress Hacked and Prevention

Hackers are hack for many reasons. Some of the common reasons why hackers hack are to get some Sensitive Information or to Steal Bandwidth to Distribute Illegal Content or may be for fun. Since there are many hackers around its our duty to keep our websites safe.

Since your site is wordpress, i will suggest some steps to prevent this in future:
1. Always update your wordpress to the latest version.
2. Configure a firewall on your server.
3. Always use complex passwords instead of simple ones.
4. Use an anti virus and update the virus database regularly.
5. Always take backup of your site on a weekly / monthly basis so that we cam restore it if anything happens.

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews